The game looked destined to finish all-square before Baldock's piledriver into the top, left-hand corner of the net gave the Milton Keynes club all three points - points which saw them replace the Robins in seventh place in the table.
The home side went ahead through Michael Smith's 19th-minute strike, before Antony Kay equalised with a bullet header as the midway-point of the second half approached.
Swindon opened the scoring when Alex Pritchard's swerving shot was palmed into the stride of Smith, who nodded home arguably the simplest goal of his career.
Mark Cooper's men nearly doubled their lead 10 minutes later when Massimo Luongo went close with a header.
The Dons grabbed the equaliser after 68 minutes as former Southampton midfielder Ben Reeves whipped in a corner that was powerfully converted by centre-half Kay.
Substitute Dean Bowditch should have put the Dons in front after being played through but Swindon goalkeeper Tyrell Belford saved well in a one-on-one situation.
The crucial goal came three minutes into stoppage time through Baldock, whose strike was worthy of winning any game.