Two late goals - including a controversial equaliser - spared the Dons' blushes after the unlucky Stags had threatened to turn the form book upside down.
Mansfield, booed off the pitch after slumping to the foot of the table at the weekend following a home defeat to Dagenham, rocked the Dons with an attacking 4-3-3 formation.
And they looked on the way to only their second win of the season when Michael Boulding headed in on the half hour - the first goal conceded by the top of the table side in four matches.
Simon Brown had taken advantage of Sean O'Hanlon's slip and raced clear. His shot was clawed out by the diving Willy Gueret, but Stephen Dawson chipped the ball back into the area and Boulding headed in off the post.
But after the home side lost 'keeper Carl Muggleton, injured making a brave save at the feet of Leon Knight on the hour, the Dons powered back for their fifth successive victory.
In the 72nd minute Lloyd Dyer burst through, rounded substitute 'keeper Jason White and just forced the ball over the line.
The goal was eventually awarded by the linesman after long home protests, which saw two players booked, that the ball had not crossed he line.
And eight minutes from time Jude Stirling completed the fightback with a fine finish on the breakaway.
Four minutes later brave Gueret denied Boulding an equaliser, racing to the edge of his area to save at the feet of the striker. Then in injury time Hamshaw blasted into the side netting as the Stags searched in vain for a deserved equaliser.
The Stags, still bottom of the Football League, were cheered off the pitch as home vans vented their anger at referee Darren Drysdale - with even Stags chairman James Derry on the pitch at the final whistle to join in the protests.