Milton Keynes were level in the 33rd minute though after an attack down their right was centred by Malvin Kamara to Izale McLeod who finished from close range.
In the second half, Ryan France had a left-footed shot saved and Delroy Facey squandered a golden chance after managing to put himself through.
Minutes later, the Dons had the chance to make City pay for that. Andy Dawson's challenge on McLeod resulted in a penalty, but Boaz Myhill saved to deny him his second goal of the game.
Myhill was beaten 12 minutes later though as a poorly defended corner was headed in by Ben Chorley.
But City levelled matters 3 minutes from time. Andy Dawson's corner was headed to the edge of the box where substitute Michael Keane struck a low drive which took a slight deflection off fellow sub Jason Price as is nestled in the bottom corner.
And the drama continued into stoppage time as City claimed a winner in the 92nd minute. After getting away with a challenge on the edge of their own box, City broke forward and the move resulted in the ball dropping to Stuart Green 20 yards out. He struck a trademark goal to end the game at 3-2.
City line-up (4-4-2): Myhill; Wiseman, Joseph, Delaney, Dawson; France (Allsopp 69), Green, Lewis, Elliott (Keane 69); Facey, Barmby (Price 82).
Un-used subs: Brock, Hinds.