An 80th-minute own goal from Danny Swailes consigned Macclesfield to their second defeat of the season.
Swailes tried to cut out a through ball from Scott Carter but only succeeded in toe-poking past keeper Tommy Lee.
Dons took the lead after 35 minutes when Clive Platt slid home after good work from Jon McGovern and Leon Crooks.
Macclesfield fought back and Kevin McIntyre levelled from the penalty spot before Swailes' unfortunate intervention decided the match.