The Gills won at the Alexandra Stadium but were made to hang on in the closing stages and were thankful for Ross Flitney's 95th minute match-winning save which secured a second successive league victory.
Andy Hessenthaler's side dominated for long periods in a see-saw battle, but the home side certainly put the Gills under intense pressure in the closing stages.
The Gills will go in Tuesday night's game at Barnet lying second in the League Two table behind Rotherham United. With skipper Andy Frampton
overcoming his sore throat, the Gills boss was able to name an unchanged starting XI for the third game running, keeping the same 4-5-1 formation.
Former Gillingham winger Mark O'Connor, one of Tony Pulis' backroom staff, was in the crowd at the Alexandra Stadium for the game.
Crewe, who have started the new season by conceding six goals in two defeats so far, looked quite lively right from kick-off and they had the first real threat on either goal in the fifth minute when a neat passing move by the home side ended with Flitney turning aside a Shaun Miller shot.
A great ball by Jack Payne instigated a move that saw the Gills test home keeper Steve Phillips in the 11th minute. The midfielder's cross-field pass found Danny Kedwell
, he held off his marker before setting up Danny Spiller, his low side-footed effort was collected by the Alex keeper at the second attempt.
Dario Gradi's side had a lucky let off in the 20th minute when defender Adam Dugdale seemed to handle as Kedwell looked to break into the area but referee Phil Gibbs waved away appeals.
The Gills were by this stage well in the game and took the lead in the 23rd minute when Chris Whelpdale
gave Phillips no chance when he cracked home a right-foot strike from around 20 yards.
Just a minute later things got even better for the 297 travelling supporters with a second goal. Joe Martin
crossed well from the left and, although it evaded Kedwell, Spiller was coming in behind him and fired past Phillips.
The Gills lost goalscorer Whelpdale through injury in the 34th minute. He had required treatment a few minutes earlier after he seemed to fall over the ball, Curtis Weston replaced him.
With the natives rather restless, Crewe were struggling to get going again but did create two quickfire chances when first Miller curled a shot just over the top in the 37th minute which was followed by Dugdale heading wide from a free-kick.
The Gills were defending high up the pitch with the likes of Kedwell, Spiller and Lewis Montrose closing down the home rearguard at every opportunity.
Five minutes before the break the Gills went close again, a neat one-two between Weston and Montrose ended with a powerful strike from the latter being parried by Phillips before the clearance was completed.
When the half-time whistle went, following five minutes of added on time, there were a crescendo of boo's from the home sections of the 3401 crowd.
H/T: 0 - 2
The Gills had a great chance to increase their lead straight after the restart following a foul on Kedwell but Spiller smacked his free-kick wide of Phillips right-hand post.
In the 50th minute from another free-kick after Byron Moore fouled Jack Payne, saw an optimistic effort from Spiller from around 35 yards going straight at the Crewe keeper.
became the afternoon's first recipient of a yellow card in the 54th minute for a sliding challenge on Dugdale and soon after both Weston and Lee fired wide as the Gills continued to open up the home defence.
Crewe began to ring the changes in the 63rd minute when England Youth international Nick Powell was withdrawn and Danny Shelley came on. Four minutes later A-Jay Leitch-Smith was introduced for Luke Murphy.
The home side then pulled a goal back in the 74th minute when a great ball from Lee Bell evaded Matt Lawrence and Miller was able to control before slotting home.
In response Spiller put an effort off target and Lee poked a shot at Phillips before play quickly returned to the other end with Payne twice in the right place to hack off the line, the second effort coming from home skipper David Artell.
It was all hands to the pump at the back for Gillingham and in the 79th minute Barry Fuller was on the line to boot clear a header from Harry Davis which came from a Shelley corner.
With seven minutes of normal time remaining Jack Payne, who had just received treatment, was withdrawn and namesake Stefan introduced.
Alex continued to surge forward and Leitch-Smith saw a shot deflected over, Montrose had to clear from in front of goal and Shelley snatched badly at a shot which flew wide from ten yards.
Both teams made late substitutions with Max Clayton replacing Miller for Alex and Matt Fish
taking over from Spiller in the 86th minute.
Flitney was then thankful that a rising Shelley strike was straight at him.
The home fans, who'd come alive as Crewe began to attack, were buoyed as yet another five minutes added time were shown by the fourth official.
Three minutes into injury time Montrose was booked for a foul while Stefan Payne quickly followed for not retreating from the resultant free-kick.
Hearts were in the mouth with around a minute remaining as Moore then got in a decent low strike from the edge of the area which Flitney got down well to and superbly touched it round the post to ensure the Gills made it six points out of a possible six.
Attendance: 3401 (297 Gillingham)
Alex: Phillips, Davis, Westwood, Artell, Dugdale, Bell, Murphy (Leitch-Smith 67), Miller (Clayton 87), Moore, C.Martin, Powell (Shelley 63)
Unused subs: A.Martin, Hughes.
Gills: Flitney, Fuller, Lawrence, Frampton, Martin, J.Payne (S.Payne 83), Whelpdale (Weston 34), Montrose, Lee, Spiller (Fish 87), Kedwell.
Unused subs: Richards, Gazzaniga