Rotherham were relegated back to League One after Marlon Pack's late equaliser denied them Championship survival.
Lewis Wing's stunning volley looked as if it was going to be enough to seal safety for the Millers, while Derby and Sheffield Wednesday battled out a 3-3 draw at Pride Park.
But Pack struck late to seal a 1-1 draw for the Bluebirds, which sealed an immediate return to the third tier for the South Yorkshire side as Wayne Rooney's Derby survived.
Millers manager Paul Warne made a pair of changes for their make or break clash with the Bluebirds.
Florian Jozefzoon, currently on loan from relegation rivals Derby, was tasked with relegating his parent club after being included as part of a front three, while Angus MacDonald slotted in at centre-back in place of Daniel Barlaser.
Sol Bamba returned to the Cardiff City squad for the last game of the season after undergoing his final course of chemotherapy in his ongoing battle with cancer.
Lee Tomlin also featured on the bench for the first time under Mick McCarthy, who named an unchanged starting side following their 4-0 triumph at Birmingham.
A stunning strike gave Rotherham a relegation lifeline after only eight minutes.
Wes Harding's cross was headed away from the Cardiff box by Perry Ng, but Wing advanced towards the high, floating clearance and unleashed a fierce volley that beat Dillon Phillips to his left for an invaluable lead.
After their flying start, the visitors had chance after chance to pile even more pressure on Derby and Sheffield Wednesday.
Captain Richard Wood headed wide from a corner before Matt Crooks sliced a shot wide after latching on to a cross from strike partner Michael Smith.
Angus MacDonald also had a shot cleared off the line, but despite their total domination, the visitors were unable to give themselves another relegation lifeline as the first half ended 1-0.
McCarthy's half-time message to his Cardiff players took effect as they came out firing in the second half.
Kieffer Moore fired over three minutes into the second period before being denied by some heroic defending from Wood.
The Rotherham bench were cheering every tackle, block and refereeing decision, but their enthusiasm waned after news filtered through of Martyn Waghorn's leveller at Pride Park.
Still, Smith pushed to make it 2-0 when he forced a save from a tight angle, but their efforts looked as if they were paling into insignificance when Patrick Roberts put Derby ahead.
But the director's box went wild when Callum Paterson equalised for the Owls to put Rotherham back in the driving seat.
As events unfolded across the border, there was still one twist left in the tale at the Cardiff City Stadium.
The hosts marched forward and found Pack with the space to drill a low strike into the bottom corner, meaning Rotherham's great fight for survival fell short.
No Data Analysis info