Chelsea's Marcos Alonso (centre) celebrates the winning goal from Ruben Loftus-Cheek during the Premier League match against Cardiff City.
Cardiff - Blues boss Sarri was on the brink of a loss that would have pushed him closer to the sack
Blues boss Sarri was on the brink of a loss that would have pushed him closer to the sack after Victor Camarasa swept struggling Cardiff ahead early in the second half.
Chelsea's travelling fans had made their feelings clear as they chanted "We want Sarri out" in the second half.
But Sarri's luck was in as Cesar Azpilicueta headed Chelsea's equaliser even though clearly offside with just six minutes left.
Chelsea's fightback got another boost when Antonio Rudiger escaped a red card when he hauled down Kenneth Zohore.
Ruben Loftus-Cheek capped Chelsea's sorely-needed escape act with a last-gasp winner.
The result keeps sixth placed Chelsea in contention for a top-four finish in the Premier League, leaving them just one point behind fourth as Sarri battles to salvage a wretched first season in charge.
Cardiff remain third bottom, with boss Neil Warnock visibly furious at the decisions that pushed his team closer to relegation.
The pressure on Sarri will reduce a little with this victory, but the performance was so unconvincing that it would be no surprise if Wednesday's clash with Brighton is another close affair for the former Napoli boss.
Despite the clamour for Callum Hudson-Odoi to be given his first league start for Chelsea after his fine England performances, Sarri was unmoved.
The 18-year-old was named among the substitutes, with Eden Hazard - scorer of a hat-trick against Cardiff back in September - also surprisingly on the bench alongside N'Golo Kante.
Chelsea controlled the early stages but the nearest they came to a threat was a long range shot by Pedro which dipped over the bar.
Cardiff's response was to create their own first opportunity.
Harry Arter's neat pass let Josh Murphy have a run at Marcos Alonso and when the winger cut inside, his shot curled the wrong side of the far post.
Chelsea were remarkably lacklustre in attack and Marcos Alonso's tame side-foot effort summed up their drab efforts in the first 45 minutes, highlighting how blunt their attack can appear when Hazard is absent.
Within a minute of the re-start Camarasa gave the home side a shock lead.
A long throw-in by Aron Gunnarsson was only half-cleared by the Chelsea defence, giving the Icelander the time to find Arter.
The midfielder clipped a pass to the unmarked Camarasa who struck a crisp half-volley from 15 yards past a startled Kepa Arrizabalaga in the Chelsea goal.
Sarri's response was to send on Hazard, just as Chelsea supporters started to chant for their manager to be sacked.
The Belgian was straight into the action as Chelsea looked for their talisman to turn things around.
An increasing desperate Sarri also sent on Loftus-Cheek and then Olivier Giroud.
But there was no introduction of Hudson-Odoi despite his impact for England.
Hazard was unable to impose himself and there was a chorus of "You don't know what you're doing" aimed at Sarri as the final whistle loomed.
But with six minutes left, Chelsea finally forced their dubious equaliser as Azpilicueta headed in from Alonso's flick.
It was the defender's first goal for almost a year, but it could prove so precious to both Chelsea and Sarri's future.
That gave Chelsea the confidence to pour forward and Loftus Cheek produced a composed stoppage-time header from Willian's cross just when Sarri needed it most.