Great finishes from Matt Ritchie and Jonathon Smith saw Swindon undeservedly take all three points at the County Ground but the Gills were left to rue missed chances.
A great performance by Andy Hessenthaler's side was undone by the goals but a horrible miss by Danny Kedwell
at 1-0 proved costly.
After a slow start the Gills certainly dominated for large parts of the game and had some decent chances, Luke Rooney struck a post, Chris Whelpdale
was denied by the keeper while Jo Kuffour saw the follow-up blocked on the line, but somehow failed to even pick up a point from the game.
With two players, Joe Martin
and Lewis Montrose missing through suspension, the Gills boss brought Danny Jackman and Charlie Lee
back into the starting XI. Danny Kedwell
was fit enough for a place on the bench where he was joined by young midfielder Dean Rance.
The travelling Gillingham squad had four ex-Robins, Curtis Weston Andy Frampton
, Jo Kuffour and Frank Nouble (in order of appearances).
Nouble was spoken to early on by referee David Coote, the forward somehow found himself on the deck as the sides waited for Ross Flitney to take a goal-kick.
The first shot of the match came in the fourth minute when the ever-dangerous Matt Ritchie fired wide from around 25 yards.
Three minutes later Rooney, who had another fine game had home keeper Wes Foderingham scrambling across his goal as his long range free-kick, following a foul on Lee, flew inches wide.
Ritchie, who was generally well-marshalled by Jackman went close again with another shot from distance which got a touch somewhere along the line - Paul Caddis was way off target from the resultant corner.
At this point Swindon were enjoying plenty of possession and looked dangerous on the break but their final ball left the forwards wanting.
With 24 minutes on the clock a break down the right ended with a low ball across the face of goal and only a superb piece of defending from Matt Fish
inside the six yard box denied Raffaele De Vita a certain goal.
Shortly afterwards Fish was again the key defender, clearing the ball off West Ham loanee Cristian Montano following a neat turn.
With almost half an hour gone Rooney and Kuffour combined to set up Chris Whelpdale
but he drilled a low shot straight at Foderingham.
On 31 minutes Lee received a harsh booking for a challenge on Jake Jervis.
Two minutes later the Gills, who had started to knock the ball around well, almost went in front.
Nouble gave his marker a few step-overs down the right before dinking a great ball towards the far post, Whelpdale rose but could only watch as Foderingham clawed his header out of the top corner and as the ball dropped to Kuffour around two yards out Alan McCormack somehow managed to block bravely.
It came as some cost to the Town defender however as he limped off moments later, Alessandro Cibocchi eventually replacing him.
Rooney and Jonathon Smith went in for a tackle moments later and the Gills midfielder required treatment from physio Steve Allen.
Just as the three minutes of time added-on were indicated Ritchie fired a low effort that forced Flitney to save low to his right.
The first 45 minutes had almost been a half of two halves, with Paolo Di Canio's side starting the brighter before the Gills ended on-top.
The Gills, backed by a noisy away support of 400 fans, continued in the ascendancy as the second-half began.
Weston twice dragged efforts wide and he then inadvertently got in the way of a low Rooney strike.
At the other end Cibocchi smacked a 30-yard free-kick straight at Flitney.
In the 57th minute Garry Richards went into the book for a foul on Jervis.
On 65 minutes the Gills went close again, very close after a great move. Rooney took a throw from Fish, played a one-two with Kuffour and then drilled a low shot past the statuesque Foderingham, unfortunately the ball ricocheted off the inside of the keepers right-hand post and out across the face of goal.
With 15 minutes remaining the Gills leading goalscorer Kedwell replaced Kuffour.
Almost immediately the Wiltshire side broke and Ritchie, worryingly in space down the right, saw his low shot saved by Flitney.
Swindon broke the deadlock with a stunning strike from that man Ritchie in the 80th minute, cutting in from the right before firing a left-footer that gave Flitney little chance as it flew into the top corner.
The Gills had a glorious chance to equalise in the 85th minute, Nouble shrugged off his marker to fire a low ball across the six-yard box, there was Kedwell unmarked but the strikers finish went horribly wrong.
Stefan Payne replaced Weston with four minutes left.
In the first minute of time added on the home side wrapped up their victory with a second great strike. Substitute Alan Connell's low ball was allowed to run to Smith around 20 yards out and he curled the ball home giving Flitney no chance once again.
The result leaves the Gills in ninth place in the League Two table but are just three points behind third-placed Shrewsbury.
On Saturday they travel to fourth-place Morecambe who let a three-goal lead slip at home to Rotherham United tonight.
Swindon Town: Foderingham, Flint, Caddis, Ferry, Ritchie, McCormack (Cibocchi 41), De Vita, Smith, Jervis (Risser 85), Montano (Connell 63), Ridehalgh. Unused subs: Magera, Abdulla
Gillingham: Flitney, Fish, Richards, Lawrence, Jackman, Whelpdale, Lee, Weston (S Payne 86), Rooney, Nouble, Kuffour (Kedwell 76). Unused subs: Gazzaniga, Frampton, Rance
Attendance: 7787 (400 Gills)