Patrick Bamford scored a stunning late winner to spare MK Dons' blushes after 10-man Rotherham had fought back from two goals down.
The on-loan Chelsea striker lashed home his 12th goal of the season two minutes from the end to ensure the Dons leapfrogged the Millers in the table, after Michael O'Connor and his manager Steve Evans had both seen red.
Rotherham striker Alex Revell was twice denied one-on-one by home goalkeeper David Martin in the first half, while Bamford and Jason Banton missed gilt-edged chances for the Dons.
Shaun Williams put the Dons ahead on the stroke of half-time when his low spot-kick squirmed underneath Scott Shearer, after O'Connor had been sent off for tripping Stephen Gleeson as he looked set to score.
Millers boss Evans was sent to the stands for an incident in the tunnel at half-time before Ben Reeves doubled the Dons' lead in the 65th minute, tapping in the rebound after Shearer could only parry Daniel Powell's low cross.
Rotherham scored twice in as many minutes to make it 2-2, first when Lee Frecklington headed in Craig Morgan's cross and then when Tom Flanagan looped a header over his own goalkeeper in the 75th minute.
But Bamford swept the ball into the top corner from 20 yards in the 88th minute to snatch the points for the Dons.