Substitute Conor Thomas scored a dramatic stoppage-time winner as Swindon ended Millwall's 16-match unbeaten run in Sky Bet League One.
Thomas netted for the relegation-haunted Robins in the 94th minute after being picked out by Nicky Ajose to secure a 1-0 win that boosts the Robins' survival chances.
Up to that point the game was lacking many clear-cut chances with both teams unable to break the deadlock.
The first half was evenly contested and the first opening fell to promotion-chasing Millwall in the fifth minute when Lee Gregory ran on to a long kick from goalkeeper Jordan Archer but could only manage a tame shot from a tight angle.
Swindon's best chance of the half came in the 21st minute when, following some intricate football on the edge of the Millwall box, Charlie Colkett took a shot destined for the right corner only for Archer to push it behind.
Luke Williams' Robins were the better team in second half but unable to capitalise on their dominance until Thomas' late heroics.
Jonathan Obika earlier seemed to have missed the opportunity to snatch victory when he was unable to get a good connection on a header.