Ruben Loftus-Cheek headed in Willian's cross in the first of seven additional minutes as the Blues - insipid for so much of the contest until the arrival of Eden Hazard off the bench - produced an impressive turnaround at the Cardiff City Stadium.
Víctor Camarasa had reacted quickly to sweep home Harry Arter's weak cross to open the scoring early in the second half, but the Welsh club were unable to cling on to their lead during a dramatic conclusion.
Cesar Azpilicueta's 84th-minute header dragged Chelsea level, though replays showed the defender was in an offside position when turning the ball home.
Substitute Loftus-Cheek then nodded in a much-needed winner for Maurizio Sarri, who had listened to a section of the travelling fans chant for him to be sacked earlier in proceedings.
The result means Chelsea move level on 60 points with Arsenal in the table, a point behind fourth-placed Manchester United in the race to qualify for next season's Champions League.
As for third-bottom Cardiff, they remain in deep trouble in the relegation zone, five points behind nearest rivals Burnley and Southampton.
The manner of the defeat visibly annoyed manager Warnock, who exchanged words with opposite number Sarri before heading out onto the pitch at full-time to stare down referee Craig Pawson and his assistants.
Hazard sparks his side into life
Following his introduction after 53 minutes, Chelsea's influential playmaker had 49 total touches and created a solitary chance. He did not score or provide an assist for his team, but his presence on the pitch resuscitated a limp performance. Sarri will think twice before leaving him out of the starting line-up in future.
Chelsea's win could prove telling in the final reckoning, but in the short term their fightback at least eased the pressure on their Italian coach.Sarri gambled with his team selection, once again leaving out Callum Hudson-Odoi as the England international joined Hazard and N'Golo Kante on the bench, but was spared by the impact of another substitute, Loftus-Cheek, in added time.
It may still be that the Europa League offers Chelsea their best chance to qualify for next season's Champions League, but a loss in the Welsh capital was a result Sarri could ill-afford as he battles to show he is worth persevering with beyond his debut campaign.