Two fine first-half goals from Frank Nouble and Chris Whelpdale helped earn the Gills the three points at the EBB Stadium.
An 81st minute strike from Scott Davies made it a nervous finale for everyone connected with the visitors including the 669 travelling fans but Andy Hessenthaler's side hung on for the victory.
This result left the Gills in eighth place in the League Two table.
The Gills boss made four changes for the game, skipper Andy Frampton (suspended), Matt Fish (we later found out was injured), Luke Rooney (dropped) and Paulo Gazzaniga missed out and they were replaced by Ross Flitney, Garry Richards, Jo Kuffour and Nouble.
After a fairly quiet opening the game came to life as the Gills surged ahead in the seventh minute.
Danny Kedwell did well to win a corner and from Danny Jackman's inswinging flag-kick Nouble found the space to move onto it and beat Jamie Young with a stooping header low to his left-hand side.
It was the fifth goal of the West Ham forward's loan spell which is due to end after this game - let's hope it can be extended.
In response Luke Guttridge smacked two free-kicks on goal, the first struck the wall but the second was brilliantly helped over the top by Flitney.
Gradually the Gills got a good foothold on the game and numerous chances were created.
Charlie Lee fired over, workaholic Danny Kedwell saw Young fly to his left to turn round great strike, skipper Matt Lawrence has a goalbound header and shot blocked while Kuffour is unable to turn on Richards nod down.
The main creator for the goal and most of these chances had been the left-foot of Jackman from right-wing corners that the Shots struggled to cope with.
Then came the second goal in the 36th minute - Jack Payne found Chris Whelpdale with a short pass and the latter moved the ball forward before firing a low effort beyond the flailing keeper from around 25 yards and it nestled nicely in the corner of the net.
There was another chance shortly afterwards but Kuffour lifted the ball onto the roof of the net from close range having moved nicely onto a Nouble cross.
Following the break Dean Holdsworth's side tightened up somewhat and after the introduction of Jamie Collins and Scott Davies looked far more threatening.
That said though the best chances in the early stages of the second-half went the Gills way.
On the hour good vision from Kuffour saw him let the ball run through his legs which allowed Jackman to fire a low shot narrowly wide.
Then Whelpdale was unlucky when from a half-cleared Lee throw, he touched the ball over his marker with his right foot before letting fly with his left which went inches over.
It wasn't until the 80th minute that the Shots really threatened, that was when a long range Collins strike was helped round the post by the full length Flitney.
A minute later and Aldershot did halve the deficit, Guttridge picked out Davies with a neat pass and the substitute smashed home from around 20 yards.
As the minutes ticked by the Gills took every opportunity to take the pace out of the game, as the home side stepped up the pace in search of an equaliser.
Both Lewis Montrose and Curtis Weston were introduced late on replacing Nouble and Jackman.
Despite a nervy four minutes of time being added on the home side failed to really threaten too often.
The best effort coming in the final minute but former Gills trialist Aaron Brown could only watch as his header drifted wide.
Aldershot Town: Young, Herd, Straker, Guttridge, Jones, Brown, McGlashan (Mekki 84), Rankine, Hylton, Rodman (Davies 66), Vincenti (Collins 54)
Unused subs: Morris, Day
Gillingham: Flitney, Lee, Lawrence, Richards, Martin, Whelpdale, J Payne, Jackman (Weston 87), Nouble (Montrose 85), Kuffour, Kedwell
Unused subs: King, Oli, Gazzaniga
Attendance - 3,249 (669 Gills)
Referee - Dean Mohareb
Assistants: Nigel Lugg & David Margetts
Fourth Official: Anthony Coggins