Ipswich suffered a hammer blow in their bid to reach the play-offs as two late goals gave Rotherham the spoils at Millmoor in a game that the visitors should have won.
Strikes from John Mullin and former Norwich City man Mark Robins clinched an unlikely double for the Millers and leave the East Anglia club in a state of shock.
The Tractor Boys dominated the first half, with Jim Magilton hitting the cross bar and Tommy Miller forcing a reflex save from Ian Gray.
But the Tractor Boys finally broke the deadlock in the 31st minute when Spanish hitman Pablo Counago nodded in Martijn Reuser's corner from close range with Gray caught in no man's Land.
After the break, the Miller's breathed a mighty sigh of relief in the 53rd minute when Shaun Barker was handed a yellow card for hauling back Reuser which on another day could have been a straight red.
After a woeful first period, the Miller's improved in the second half with Alan Lee seeing his 62nd minute header from a Mullin cross held by Andy Marshall.
Seven minutes later, the Millers went tantalisingly close to levelling when a Fabian Wilnis error let in Robins but his effort was brilliantly parried by Marshall, who performed similar heroics to deny the ex-Norwich man soon after when he tipped over his fierce shot in fine style.
Millers boss Ronnie Moore switched to a 3-4-3 system in the second half with his side testing the visitors with a series of long throws from Barker and Nick Daws, but it looked for the most part that the Tractor Boys would see out the game.
But just when they looked home and dry the Millers drew level with a freak 86th minute goal. Marshall raced out the punch clear a Barker throw, with Mullin latching on to the loose ball and lobbing it back into the danger area with it amazingly dropping into the net despite despairing final touch from Marshall.
Two minutes later, the Millers were in dreamland when another long throw arrived on the head of Ipswich old boy Chris Swailes whose powerful effort was parried by Marshall with Robins following up to bag the rebound.
In a grandstand finish, there was still time for Gray to deny Counago and Marcus Bent while at the other end Lee and substitute Darren Byfield fired efforts over.