Sunderland hopped into a play-off spot after Dean Whitehead stole a controversial goal that stunned Ronnie Moore's Rotherham United.
Keeper Mike Pollitt had been the hero as the Millers held out against Mick McCarthy's Premiership hopefuls.
But he was beaten in the 61st minute when Whitehead was played in by Stephen Elliott to slam home his shot as Pollitt dived at his feet.
Furious Rotherham protested that Whitehead was offside and tv replays underlined the claim, but the goal stood, stretching Rotherham's dismal run to a club record 15 without a win.
And the result pushed Sunderland into sixth spot in the table, above Rotherham's neighbours Sheffield United.
After an early scare from Rotherham's Brazilian striker Junior, on loan from Derby, Sunderland were denied by Pollitt's heroics.
Pollitt produced a string of saves including a tremendous double stop early in the second half to shut out Darren Carter and leading scorer Elliott.
Elliott was denied his eighth of the season when his blistering long-range effort beat Pollitt but smacked against the woodwork in the 13th minute and Pollitt pulled off a fine save from Marcus Stewart's follow-up.
Julio Arca had the visiting fans on their feet with a typical darting attack, but Pollitt cut out his shot and Stewart was high with an ambitious long-range drive before Pollitt held on to another Elliott effort.
Just a minute into the second half Carter's shot brought a stunning save from Pollitt and a repeat from Stewart's follow-up, before the keeper made two more saves from Elliott.
But Whitehead pounced in the 61st minute after Elliott controlled and played him through as the linesman dawdled.