Millwall made it three wins on the spin on a night of red card shame for Gillingham that saw Paul Konchesky and Bradley Dack dismissed in the second-half.
Lee Gregory fired Millwall into a first-half lead and Fred Onyedinma added a second moments before Konchesky was shown his second yellow card for a desperate foul on the young Lion.
Although Bradley Dack offered the 10-man Gills a ray of hope by reducing the arrears on 76 minutes, he turned the fog over south east London turned to red mist once again in injury-time when he was sent off for a poor challenge on Ben Thompson.
Had referee Tim Robinson not blown his whistle, Max Ehmer could well have become sending off number three for the ill-disciplined visitors after another late challenge on midfielder Thompson.
Lions boss Neil Harris was able to name an unchanged team for the third successive match, and having won the previous two matches against Charlton (3-1) and Swindon (2-0), had every reason to feel confident going into Friday night's game.
Gillingham, enjoying a mini revival in form themselves with 14 points from their last eight fixtures, also fielded the same XI that had grabbed a late Boxing Day point in a 1-1 draw at Peterborough United.
Millwall got off to a dream start after 12 minutes when a perfectly weighted delivery from Shaun Cummings was flicked into the path of Gregory by Steve Morison and the striker produced a sublime low finish that gave Stuart Nelson no chance in the visiting goal.
The Lions had the ball in the back of the net again on 18 minutes with a cute clipped finish from Gregory from Thompson's threaded pass, but the effort was ruled out for the tightest of offside decisions.
A superb show of speed, strength, stamina and sheer determination by Onyedinma earned a roar of approval from The Den faithful as the youngster tracked back to eventually out-muscle Jay Emmanuel-Thomas, and in doing so also earn a free-kick.
It took a perfectly timed interception courtesy of Byron Webster's right boot to avert the danger as Cody McDonald shaped to shoot and then the safe handling of Lions keeper Jordan Archer, gathering low at his near post from a dangerous cross, to keep the visitors at bay as Gills began to settle into their stride.
Thompson was shown the first yellow card of the night for a late challenge on Scott Wagstaff, but it took until the 35th-minute for Justin Edinburgh's side to create their first real noteworthy chance of the opening half, a powerful Emmanuel-Thomas header from Bradley Dack's free-kick that flew wide of the target.
Former Arsenal forward Emmanuel-Thomas was proving an awkward customer and Gillingham tried to work the ball to the powerhouse forward at every opportunity, but he found little joy against the wily experience of skipper Tony Craig, snapping away at his heels every time he was in possession.
Despite soaking up a significant amount of pressure, it was The Lions who twice had opportunities to add to their single goal tally before the break.
Thompson had time to control the ball and take aim from 20 yards after good work from Morison, but lashed the ball high over the bar and Onyedinma then poked a shot straight into the hands of keeper Nelson from close range with the closing action of the half.
There were howls of protests from the home fans early in the second-half when Aiden O'Brien went to ground from a Ryan Jackson challenge, whilst at the other end Emmanuel-Thomas fired wide before Wagstaff had a half chance from the edge of the box saved.
Konchesky went into referee Tim Robinson's book for a crude 58th-minute challenge on Gregory and although the resulting free-kick didn't come to anything, it only took Millwall six more minutes to add a second goal.
Onyedinma had one effort saved by keeper Nelson but somehow managed to hook the ball over the line whilst on the ground, with the Gills defence left looking at each other in disbelief.
Another barnstorming run from Onyedinma was brought to a shuddering half by a desperate lunge from left-back Konchesky, leaving Robinson no alternative other than to brandish a red card just moments after Millwall's second goal.
Tempers were now running high in the visiting camp and Josh Wright was booked for dissent and referee Robinson did well to handle an increasingly agitated Gillingham side with Dack's petulant reaction to conceding a free-kick seeing the official reaching for his pocket yet again to brandish a yellow card.
Gillingham were handed a lifeline 16 minutes from time with Dack's crisp first-time 16-yard strike and although enjoying a numerical advantage, it proved to be a nervy final quarter of an hour for the home side as Gillingham pressed forward in search of an equaliser.
Archer did well to parry a low drive from Dack before Hutchinson put his boot through to clear and Emmanuel-Thomas went close again as Edinburgh's charges really turned the screw.
Thompson was a whisker away from restoring Millwall's two-goal cushion with a thumping 25-yard drive that flew inches over the bar as The Lions responded, and some neat interplay between Cummings, Worrall and Morison ended with the latter hooking the ball over a defender's head and firing a shot straight into Nelson's arms as the game entered the final minute.
Any hopes Gillingham had of snatching a dramatic injury-time leveller were all but extinguished when Dack was sent off for a crude tackle on Thompson, and with the momentum back in their favour, Harris' men were able to see out the dying moments to hold on for victory.
Millwall: Archer, Cummings, Hutchinson, Craig, Williams, Thompson, Gregory (Butcher, 90+3'), Onyedinma (Worrall, 76'), Webster, Morison, O'Brien (Ferguson, 66'). Subs not used: King, Romeo, Abdou, Smith.
Bookings: Thompson (28'), Gregory (90')
Scorers: Gregory (12'), Onyedinma (63')
Gillingham: Nelson, Jackson (Donnelly, 89'), Ehmer, Wagstaff, Hessenthaler (Oshilaja, 69'), McDonald (Nouble, 69'), Konchesky, Cargill, Dack, Wright, Emmanuel-Thomas. Subs not used: Hadler, Herd, Oldaker, Byrne.
Bookings: Konchesky (58', 66'), Wright (70'), Dack (76', 90+3')
Sendings off: Konchesky (66'), Dack (90+3')