Farid El Alagui scored a stoppage time equaliser to extend Brentford’s unbeaten start to the 2013/14 season.
Adebayo Akinfenwa put Gillingham in front just before half time and that looked as if it would be enough to leave Brentford with nothing.
But El Alagui came off the substitute’s bench to lash home four minutes after the 90 to give Brentford a share of the spoils
A strong wind made it difficult for any pattern to be established.
Brentford soon got to grips with the conditions, learning how much flight to give their longer balls and keeping it on the floor as much as possible.
The slick passing and movement from the visitors was soon getting its rewards and, apart from a short spell, Brentford dominated the first half.
They did not, however, continue in the same way after the break.
Although The Bees had the better of the territory they did not create as much as they would have liked and it took a last gasp goal to give them something.
After a slow opening, Shaleum Logan shot wide for The Bees and Harlee Dean headed an Adam Forshaw free kick straight at Stuart Nelson in the home goal before a Will Grigg header was blocked.
Forshaw, playing in a role between Brentford’s three-man midfield and two strikers, had a shot blocked after exchanging passes with Toumani Diagouraga and then curled a free kick narrowly over.
Forshaw and Diagouraga were to the fore as Brentford took control but they couldn’t find a way through.
Diagouraga had perhaps the best chance when Brentford broke forward quickly; he exchanged passes with Logan but wasted the shooting chance by firing high over the bar from inside the penalty area.
The Bees had to replace Jake Bidwell with Javi Venta 16 minutes in after the left back suffered a knock on the ankle.
Gillingham’s best spell of the first half followed, albeit there was no sign the defensive reshuffle – with Logan moving to left back – was a factor.
The home side relied on their physicality, trying to knock Brentford out of their stride, and throwing the ball in to the penalty area whenever possible.
Myles Weston had a shot blocked early on and when The Gills found their feet, Charlie Lee short over, Joe Martin had an effort blocked and David Button saved an Adam Barrett header.
Brentford soon regained the initiative and looked the most likely team to open the scoring.
Grigg had a shot blocked, a Diagouraga effort bobbled wide and George Saville shot over.
Grigg went close again when he turned well on to a Saville pass and fired wide from 15 yards and Brentford had the ball in the net soon after when, after a superb move, Alan McCormack crossed to the far post and Clayton Donaldson headed home.
Unfortunately for The Bees, assistant referee Carl Fitch had his flag raised as the striker was offside.
And that proved costly as Brentford fell behind within minutes.
Weston crossed to the far post, Danny Kedwell headed down and Akinfenwa turned and fired in a shot that Button got a hand to but couldn’t keep out.
The goal had come against the run of play, and all logic, and Brentford should have levelled almost immediately when a corner was half cleared, Forshaw delivered it back and Tony Craig got ahead of his man but the defender headed over from close range.
With a goal to hang on to, the home side were snapping in to every tackle and flying for every loose ball after half time.
The pace of the game increased and while Gillingham spent much of the game with eleven men behind the ball, they broke at pace and had some nice interplay in attacking areas.
Brentford were doing most of the attacking though, Leon Legge had to make a recovery tackle to prevent Donaldson running in behind the home defence and a Logan shot deflected to Nelson.
Forshaw fired in a low shot that hit the outside of the post and Donaldson shot wide on the turn.
The home side almost sealed it when substitute Cody McDonald fed Weston, his low shot was saved low by Button and the goalkeeper combined with Dean to keep out Lee’s follow-up with the home side appealing a foul had been committed.
Brentford kept looking for a way back in to the game but chances were few and far between.
Forshaw shot wide and Donaldson headed a corner over but Gillingham were repelling with relative comfort what Brentford were offering.
The Bees pressed hard in the dying moments – Conor McAleny had a shot blocked before McCormack slipped a ball through to Donaldson but his effort was saved.
Logan headed a Venta cross wide at the far post before McAleny weaved his way through and set up a shooting chance for Donaldson, as the defenders rushed out, the shot ricochet around, hit the outside of the post and bounced wide.
Time appeared to be up when Brentford were awarded a free kick 30 yards out, Forshaw chipped it in, Dean stole round the back and headed across for El Alagui to bounce a shot in to the top of the net.
That wasn’t the end of the drama.
Straight from the kick off McDonald dribbled his way through and sliced a shot wide under pressure from Craig.
The striker threw himself down and claimed a penalty from referee Gavin Ward but the official waved away the appeals.
Craig took exception to the action of McDonald and a melee ensued as the home side’s frustration – with the equaliser and the official, who had penalised Gillingham repeatedly for their rough tactics – boiled over.
The appeals and protests continued after the final whistle, which was blown seconds later.
Gillingham: Nelson; Harriman, Legge, Barrett, Martin; Whelpdale, Gregory, Lee, Weston (sub Allen 82 mins); Kedwell, Akinfenwa (sub McDonald 62 mins)
Subs (not used): Howard, Davies, German, Dack, Grant
Bookings: Nelson (72 mins), McDonald (90 mins), Legge (90 mins)
Brentford: Button; Logan, Dean, Craig, Bidwell (sub Venta 16 mins); McCormack, Diagouraga (sub McAleny 56 mins), Saville; Forshaw; Donaldson, Grigg (sub El Alagui 74 mins)
Subs (not used): Bonham, O’Connor, Saunders, Fillo
Bookings: Craig (90 mins)
Attendance: 6,225 (1,144 Bees fans)
By Chris Wickham