Paul Warne's first goal of the season threw a major spanner into the promotion works for Reading who went down to a stunning late defeat at Millmoor.
The Millers striker is out of contract in the summer and was recently linked with moves to Mansfield and Oldham. But he scored from close range with practically the last kick of the game in front of the lowest Championship crowd of the season at Millmoor.
Just 3,804 bothered to turn up, but most will have gone home happy after the Millers clung onto their Championship lifeline in the most dramatic way possible when Warne struck home after John Mullin had flicked on Martin McIntosh's free-kick.
It was harsh on the Royals but they only had themselves to blame after spurning a hatful of chances. They were also denied by the woodwork on two occasions.
Mike Pollitt made a great first-half save when he tipped Ivar Ingimarsson's header onto the post in the 23rd minute and 17 minutes from time midfielder Ricky Newman saw his bundled effort graze the post with the goal at his mercy.
Andrew Hughes also missed a great second-half chance on the hour with Pollitt making a fine point-blank save after he had raced out of his goal while Steven Sidwell went close with a 30-yard wind-assisted first-half drive.
Glen Little was also cursing his luck in the opening half after McIntosh brilliantly cleared his goalbound effort following a mazy run by the former Burnley man.
The Millers' best chance in the first half came after just five minutes when Reading keeper Marcus Hahnemann was punished for handball after picking up Sidwell's back-pass.
From the edge of the six-yard box McIntosh saw his fierce effort deflected by one of the players in Reading ten-man wall.
But it was Rotherham that eventually took all three points thanks to Warne's last-gasp effort.