Cardiff City moved clear of the Championship relegation zone as Cedric Kipre's late goal earned them three points at relegation rivals Rotherham.
The sides were level at half-time through two headed goals as Cardiff's Kion Etete saw his effort cancelled out by Chiedozie Ogbene on 38 minutes.
Sory Kaba missed a penalty as the contest seemed destined for a draw.
Cardiff found a winner on 87 minutes as Kipre smashed home from close range as Rotherham failed to clear a set-piece.
The goal was greeted with joy by the travelling Cardiff supporters, who know their side is now all-but safe, six points outside of the bottom three with two games left to play.
The Bluebirds rise to 18th, with Rotherham 20th, three points above the drop zone.
This was a contest with high stakes for both sides, who entered the rearranged game still anxiously looking over their shoulders.
Rotherham boss Matt Taylor made three changes to the side that fell to a last-gasp defeat at Bristol City last time out with Wes Harding, captain Richard Wood and Ollie Rathbone all earning recalls.
Cardiff manager Sabri Lamouchi made just two alterations to the team that drew 1-1 with Stoke with goalkeeper Ryan Allsop missing out through injury and Jaden Philogene coming into the side to replace Romaine Sawyers.
Philogene had put Cardiff ahead in the original game, which was abandoned after 47 minutes because of torrential rain with visitors dominating.
However, from being 1-0 up on 18 March, Cardiff could easily have been behind in the opening minutes as ex-Bluebirds striker Jordan Hugill went close with a header that stand-in goalkeeper Jac Alnwick had to save.
Hugill thought he was going to go clear moments later with Cardiff's Kipre appearing to foul the forward, but the defender was reprieved for what would have been a red card offence.
Cardiff again opened the scoring in south Yorkshire when they took the lead on 11 minutes as Etete outjumped his marker to head home Perry Ng's excellent cross.
The visitors might have added to their lead midway through the half when Sory Kaba found space in the box and was able to fire at goal, but Viktor Johansson was equal to his effort.
Rotherham edged back into the contest and levelled on 38 minutes as Wes Harding's brilliant cross evaded Cardiff's defensive line with Ogbene on hand to nod home.
Cardiff blew a golden chance to lead before the break as Conor Coventry hauled down Philogene in added time, but Kaba's penalty rattled the crossbar.
The Championship's lowest scorers have now missed five of their six penalties this season.
The hosts looked the more threatening after the interval as they applied plenty of pressure on the Bluebirds, but chances were in short supply.
However, Cardiff found a late winner as Kipre fired home a volley into the roof of the net after Rotherham failed to clear after Johansson saved Etete's initial effort following Joe Ralls' corner.
Rotherham are winless in their last seven league meetings with Cardiff and will still be concerned about their Championship survival.
Rotherham United: Johansson, Harding, Bramall, Coventry (Wiles 84'), Wood, Hugill (Kelly 67'), Ogbene, Lindsay, Rathbone (Fosu 70'), Peltier (Quina 84'), Humphreys. Subs Not Used: Hemfrey, Ferguson, Hjelde.
Cardiff City: Alnwick, McGuinness, Kipré, Ng, Romeo, O'Dowda (Simpson 46'), Ralls, Wintle, Philogene (Sawyers 90'), Kaba (Wickham 71'), Etete. Subs Not Used: Luthra, Rinomhota, Ojo, Harris.