Former Cardiff striker Cameron Jerome's double helped complete a shock turnaround as Derby County beat his former employers 3-1 to hit the Bluebirds' automatic promotion hopes.
Cardiff had the better of an entertaining first half and led at the break after Callum Paterson slotted in Joe Bennett's cross from deep at the far post (28).
Derby were dominant after the break and survived another scare when Gary Madine scuffed his effort from eight yards, but minutes later Jerome levelled (69) following a horrible mix-up in the Bluebirds defence.
It was a similar story when Andre Wisdom robbed substitute Yanic Wildschut in the box and squared for Matej Vydra (82), and late on Jerome sealed victory when outmuscling Sean Morrison (90) before beating Neil Etheridge.
Derby: Carson (6), Keogh (7), Davies (6), Forsyth (7), Wisdom (6), Huddlestone (7), Johnson (7), Olsson (5), Weimann (6), Jerome (8), Lawrence (6).
Subs: Vydra (7), Hanson (n/a), Pearce (n/a)
Cardiff: Etheridge (6), Manga (7), Bamba (6), Morrison (5), Bennett (6), Paterson (6), Gunnarsson (6), Ralls (6), Ward (6), Hoilett (7), Madine (5).
Subs: Zohore (5), Pilkington (6), Wildschut (5).
Man of the match: Cameron Jerome
Cardiff remain a point above third-placed Fulham in the race for the second promotion place in the Championship, while Derby jump above Millwall and into sixth, two points inside the play-off places with two games to play.
Derby's newly-adopted 3-4-3 appeared to help them feel more at ease in the opening stages and they fashioned the first clear chance when Tom Lawrence met Andreas Weimann's cross, but after taking a touch was thwarted by an onrushing Etherington.
Cardiff responded with a spell of possession in the Rams' half and could have been awarded a penalty when the ball struck Bradley Johnson's outstretched elbow in the box.
Their frustration at that decision was short-lived, however. Marcus Olsson left Paterson to his own devices when Bennett flighted the ball to the back post from deep, and he fired in a well-struck opener.
Cardiff made four changes from their win over Nottingham Forest, including Gary Madine's return in attack.
Derby's switch to a 3-4-3 also saw top scorer Matej Vydra sacrificed, with Cameron Jerome brought into the squad to start.
Any Derby resurgence took until half-time to materialise, and they spent long periods of the second half camped in the Cardiff half.
But it was not until Etheridge dropped the ball from a Derby corner that they got their rewards, with Aron Gunnarsson's clearance returned to the box, where Jerome held off Morrison to level.
And they completed a turnaround few had been expecting eight minutes from time, when Wisdom robbed Wildschut and centred for top-scorer and substitute Vydra, surprisingly named on the bench, to smash home his 20th league goal of the season beyond Etheridge.
Cardiff passed up a fine chance to level when Kenneth Zohore's glancing header was met by Wilschut at the far post, but he looked back into the middle instead of going for goal and wasted the opportunity.
Derby would do no such thing from their next attack, with Jerome outmuscling Morrison far too easily when the two competed for a long ball forward, and the latter was left on his backside as Jerome strolled through to wrap up victory.
Man of the match - Cameron Jerome
Having scored only once for Derby since joining from Norwich in January, Jerome trebled his tally for the Rams with a double forged in physical desire and strength against Cardiff.
He looked like he wanted the ball more than Morrison on both occasions as he built the Cardiff defender for both of his goals, and took on more duels (26) than anyone else on the pitch.
Gary Rowett: "It's massive. I said to the players beforehand that we're not going to get a second chance because if we didn't win it's out of our hands. It's a massive boost for us at the moment because having been on the run we've been on, it's incredibly deflating and difficult to put your finger on exactly what it is that can make you go from only losing a couple of games in 22 to only winning a couple in 13.
"It's been really tough, probably the most difficult period of my six-year managerial career, but we retained belief and I thought tonight was probably as well as we've played. I thought we showed a lot of courage to get back."
Neil Warnock: "It's just unlike us. I thought it was a game we should have won. I'm disappointed in crucial decisions but that doesn't compensate for the disappointment of letting three Sunday League goals in.
"When you make elementary errors like we did for all three goals - Neil could have let it go out for a goal kick, (Aron) Gunnarsson slices it, there's that many mistakes in one goal and the second one was a forward doing the wrong thing."
Cardiff travel to Hull City on Saturday, needing a win to guarantee they end the day inside the top two. Derby County take on Aston Villa, two places but 11 points above them.