Lewis Guy spared the blushes of veteran keeper Neil Sullivan when he swooped to score the winning goal for Doncaster.
Hit-man Guy smashed home a left-footed drive underneath the despairing dive of Petr Brezovan after Jason Price's effort was blocked and the ball fell to him.
Former Scotland international Sullivan had gifted Swindon a way back into the game when he fumbled Sofiane Zaaboub's cross on 47 minutes.
Striker Simon Cox bundled the ball home after a desperate goalmouth scramble for his sixth goal of the season.
Doncaster had taken the lead in the 31st minute through midfielder Brian Stock.
Stock was played through with a lovely 40-yard pass from Guy and lashed the ball past Brezovan from 20 yards and into the bottom right-hand corner of the net.
Swindon had threatened early on when Zaaboub played in Cox but his 20-yard effort went well wide of the right-hand post.
Swindon striker Billy Paynter also went close for his side on the half-hour mark but his shot was well saved by Sullivan.
After Doncaster took the lead, Swindon tried desperately to get back in the game.
Christian Roberts came on for Zaaboub on 74 minutes and made an immediate impression.
The Welshman hit a dipping volley from 25 yards that flew just over Sullivan's bar.
James Hayter came close to doubling Doncaster's advantage in the 87th minute.
Striker Hayter hit a beautifully timed volley from 25 yards that just dipped too late and cleared the bar by mere centimetres.
Swindon substitute Barry Corr missed a golden opportunity to equalise for his side in the 89th minute.
From a corner, Corr was lurking on the edge of the area and the ball fell to him 15 yards out.
The big striker made a good connection with his shot but hit the ball straight at the grateful Sullivan who gathered the ball.