Graham Westley's side had been on a seven-game winless run before Tuesday night but put it right thanks to goals from Lukas Akins and Filipe Morais against the play-off chasers
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 that 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 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.