The Millers found themselves 2-0 behind after just 13 minutes but with four minutes of normal time to play they had turned the game on its head.
Substitute Freddie Ladapo scored twice in 15 minutes to add to Dan Barlaser's strike just after the hour mark.
Goals from Alex Gilbey and Joe Mason had given the home side an early lead but the game ended on a sour note for MK Dons as Baily Cargill was sent off in injury time.
Cargill had a hand in the opener as he found Gilbey who slotted past Daniel Iversen with just four minutes on the clock.
Nine minutes later the Millers were facing an uphill battle as Mason unleashed an unstoppable strike to double the home side's advantage.
Rotherham restored calm to proceedings and were back in the contest midway through the second half.
Cargill was guilty of hanging onto the ball for too long, allowing Barlaser to steal in and get United on the score-sheet.
Ladapo then drew the Millers level as he got on the end of Kyle Vassell's free-kick.
But there were still more twists and turns to come as the substitute then crashed a penalty off the crossbar.
It had little significance, however, as he soon grabbed the winner with just four minutes to go.
A delighted Paul Warne reacted: “Vass and Freddie were a constant thorn when they came on.
“Vass was unbelievable. The lads trust him. He demands a lot from people on the pitch.
"Everything that was good about us in the second half came through him and he will be really pleased. I’ve been singing his praises for weeks and it was nice to put him on.
“Vass’ delivery was excellent. You have to put the ball in areas to attack and he did that. I’m exhausted but really pleased.”