MacKenzie profited from a mistake by Posh goalkeeper Joe Lewis to prod home the winner after 69 minutes, extending the Dons’ winning run to five games and ending Posh’s eight-match unbeaten run.
Peterborough dominated a lively first half and Dons keeper David Martin produced two excellent diving saves to keep out Charlie Lee’s half-volley and a low drive from George Boyd, who also curled a shot against the foot of the post.
Dons midfielder Peter Leven hit a 20-yard effort against the post on the stroke of half-time before the hosts seized control after the break.
But they were twice indebted to Martin for keeping the scores level, first when he parried Lee Tomlin’s 25-yard drive and then when he saved at the feet of Craig Mackail-Smith.
And Peterborough were made to pay for their misses when MacKenzie broke the deadlock, poking the ball home from close range after Lewis had spilled a cross from Mathias Doumbe to move the Dons into fifth spot in League One.