Leon Osman scored in the 90th minute to earn Derby a point at Pride Park.
Graham Kavanagh's spectacular strike looked to have earned Cardiff victory on the hour.
Cardiff had only equalised a minute earlier, Robert Earnshaw cancelling out
Ian Taylor's 49th-minute opener.
But Osman rifled the ball past Martyn Margetson to earn the Rams a vital point in their bid to stave off relegation.
Kavanagh clattered into Rams midfielder Tom Huddlestone to earn a booking just 41 seconds into a
goalless first half during which City squandered two excellent chances.
First Richard Langley sent Paul Parry scampering through, but Derby goalkeeper Lee Grant was alert to the danger and spread himself well to make the save.
And moments later Parry turned Rob Edwards inside-out before teeing up Earnshaw, but the City top-scorer's disappointing effort was dealt with by
Grant.
Taylor then missed his side's best opportunity of the half. Marco Reich shrugged off a couple of crunching Cardiff tackles to reach the byline and sent over a fine cross, but Taylor's far-post header sailed over the crossbar.
Shortly before the interval Osman got on to the end of a Candido Costa cross but sliced his shot wide.
The hosts got off to a dream start after the break when the Cardiff rearguard gave away a needless corner.
No-one tracked Taylor's run into the area and the former Aston Villa man rose unchallenged to thump Costa's centre into the top right-hand corner of
Margetson's goal.
Cardiff thought they had earned an immediate chance to level when Peter Thorne burst into the area and went to ground, but the referee thought differently and
booked the striker for a dive.
But the visitors turned the game on its head with two goals in the space of a minute.
Langley twisted and turned by the corner flag before sending over a cross which was met by Thorne, who knocked the ball down for Earnshaw to stab his 23rd
goal of the season past Grant.
And the travelling support had barely finished celebrating when the ball came out to Kavanagh on the edge of the Derby area.
He needed no second invitation, thumping a dipping effort past the despairing dive of Grant to put the Bluebirds ahead.
Earnshaw should have doubled Cardiff's advantage when Rhys Weston pulled the ball back across Derby's area, but the striker's shot drifted narrowly wide.
And they were made to pay when Osman ghosted in at the far post and converted Richard Jackson's cross to earn the Rams a dramatic point.
Derby: Grant, Edwards, Vincent, Taylor, Costa, Johnson, Mawene, Reich, Huddlestone, Osman, Whelan. Subs: Camp, Jackson, Bolder, McLeod, Tudgay.
Cardiff: Margetson, Weston, Barker, Gabbidon, Vidmar, Boland, Parry, Kavanagh, Langley, Earnshaw, Thorne. Subs: Alexander, Whalley, Prior, Campbell, Lee.
Referee: M Pike (Cumbria).