Graham Westley's side went into Tuesday's match at The Lamex Stadium on the back of a seven-game winless run in the league, but produced a spirited display to record just their sixth victory of the season.
Lukas Akins opened the scoring six minutes before the interval with a superb finish, before Portuguese midfielder Filipe Morais made sure of the three points from the penalty spot 11 minutes into the second half.
Swindon, who picked up a vital 2-1 win over play-off rivals Peterborough United on Saturday, were unable to respond, meaning their streak without a League One victory away from home extended to five games.
In Tuesday's other fixture, Adam Rooney spurned an opportunity to earn a point for Oldham Athletic as he missed a penalty in the last minute of their 1-0 defeat at Walsall.
Sam Mantom's third league goal of the season gave the hosts the lead in the 66th minute.
Oldham were handed a perfect route back into the game with a 90th-minute spot kick, but goalkeeper Richard O'Donnell was Walsall's hero as he saved Rooney's effort to give Dean Smith's team their third straight home league win.
Thank you for reading 5 articles this month* Join now for unlimited access
Enjoy your first month for just £1 / $1 / €1
*Read 5 free articles per month without a subscription
Join now for unlimited access
Try first month for just £1 / $1 / €1