Lewis Montrose was both hero and villain as the Gills managed to hold on against the odds for the three points despite having two men sent off in the second-half against Oxford United.
Montrose put Andy Hessenthaler's side ahead with a cracking late first-half strike but then became the second Gillingham player to see red, following Joe Martin for an early bath.
Martin went for two yellows and Montrose for a straight red for a rash challenge late on in a game where a few tackles were flying in - referee Gavin Ward certainly won't be winning any popularity contests across Medway in the near future.
Bizarrely while Martin and Montrose were the only Gillingham players to pick up cards, United, who let there frustrations get the better of them as the game went on, picked up six yellows.
The hard-fought victory took the Gills up to fifth place in the League Two above Chris Wilder's side who saw their eight game unbeaten run ended, they were made to pay for their failure to take their chances.
Following last weekend's 5-2 victory at Torquay, Gills boss Hessenthaler named the same XI but the bench was strengthened by the inclusion of Andy Frampton, Danny Jackman and Charlie Lee, all of whom were returning from injury.
It was the visitors who created the first openings but after neat moves, first Alfie Potter, then Simon Heslop failed to get their efforts on target.
The response came quickly, Jo Kuffour seemed to be bundled over as he looked to get in the box, Frank Nouble broke down the left but Ryan Clarke cut out the cross-cum-shot, before Luke Rooney and Chris Whelpdale both tested the U's keeper from distance.
Joe Martin received the first yellow card of the afternoon from referee Gavin Ward for a challenge on Damian Batt.
The Gills were struggling to keep possession as United pegged them back and had a let-off in the 23rd minute when West Ham loanee Robert Hall got in behind the home defence but Ross Flitney narrowed the angle well to block his low effort.
In the 25th minute Paul McLaren was booked for fouling Kuffour almost on the halfway line.
United were enjoying the luck of the bounce, every ricochet seemed to drop to a visiting player but it was in the final third that they were again lacking. The next long range strike, from Liam Davis, was again at Flitney.
In the 41st minute Deane Smalley was forced off and straight down the tunnel for presumably some stitches on a cut that left him bloodied - and apparently needed 14 stitches.
With Oxford having failed to take their chances and still down to ten men, the Gills showed them how to do it in the 45th minute. Kuffour's shot from the left was beaten out by Clarke but Lewis Montrose slammed the ball into the keepers top right-hand corner from the edge of the area.
The second-half couldn't have started any worse for the Gills as a challenge from behind by Martin on Hall was deemed sufficient for a second yellow by the fussy referee which saw the left-back dismissed.
Gillingham were forced to reshuffle and a substitution saw Nouble replaced by Danny Jackman in the 52nd minute.
Heslop brought a fine save out of Flitney with a fierce strike, the keeper turning it aside before the visitors threw on striker James Constable (for Heslop) but it didn't improve their finishing in any way, Davis angling a strike into the Rainham End and Potter slicing wide.
The Gills keeper then made a smart reflex save to keep out another strike from dangerman Hall before skipper Matt Lawrence put his body on the line with a tremendous block to deny Potter after Constable had gone round Flitney.
Oxford brought on new loan signing Danny Philliskirk (from Sheffield United) and his first mark on the game (or rather Fish) brought a booking.
As the Gills looked to try and hold on to what they had Andy Frampton replaced Rooney in the 74th minute.
Peter Leven then tested Flitney with a free-kick but once again the keeper proved his mettle with a decent save.
After Lee had struck a free-kick straight at Clarke it looked like Kuffour, from a Curtis Weston pass, had settled the game with a second goal - unfortunately a very late flag saw it ruled out for offside.
With two minutes of normal time remaining the Gills were reduced to nine men when a rash challenge by Montrose on substitute Asa Hall almost on halfway was deemed serious enough for a straight red from Mr Ward.
Potter fired another effort straight at Flitney and Oxford threw veteran defender Michael Duberry forward as the Fourth Official indicated five minutes of added time.
A great ball forward from Leven sent Constable clear but the striker only managed to send his attempted lob into the Rainham End which was again in full voice as their heroes fought against adversity on the pitch.
That was it from the opposition, apart from two more yellows, but almost right on the final whistle a tiring Kuffour went through one-on-one with the keeper who managed to clutch the low effort.
Thankfully for man-of-the-match Kuffour, the referee blew immediately afterwards to save him having to run any more.
The Gills now have to re-group, assess any injuries and plan without Martin and Montrose for Tuesday's trip to face old rivals Swindon Town, Paolo Di Canio et al, who today won 1-0 at struggling Plymouth Argyle.
Gillingham: Flitney, Fish, Richards, Lawrence, Martin, Whelpdale (Lee 65), Weston, Montrose, Rooney (Frampton 74), Nouble (Jackman 52), Kuffour.
Unused subs: S.Payne, Gazzaniga
Oxford United: Clarke, Batt, McLaren (A.Hall 78), Duberry, Wright, Heslop (Constable 55), Smalley (Philliskirk 68), Potter, Leven, Davis, R.Hall.
Unused subs: Whing, Kinniburgh.
Attendance: 5819 (559 Oxford fans)
Referee: Gavin Ward
Assistants: Ryan T Atkin and Elliott Kaye
Fourth Official: Paul Kelly