Second half goals from Marlon King and Trevor Benjamin brought our four-match winning run to an end, while the woes were compounded by Jermain Defoe's late sending-off for foul and abusive language.
Although unchanged, Hammers seemed a completely different side from that which romped to a 3-0 victory at Crewe Alexandra in midweek and struggled to cope with the physical approach and determination of the Gills.
First half report:
After a relatively quiet opening five minutes, Gillingham created the first decent chance of the game when Nosworthy's dangerous cross from the right cleared the Hammers defence and dropped to King and Shaw, who appeared to get in each other's way as they attempted to shoot and the ball dribbled wide.
Sidibe then headed wide of the target from 10 yards out and it wasn't until the 15th minute that Hammers created their first opportunity of the afternoon, when Quinn's looping cross from the left beat goalkeeper Brown and a defender, but Connolly was just inches away from making contact at the far post.
The Irish international came a lot closer six minutes later, though, when he collected a low cross from Etherington with his back to goal and turned brilliantly before firing in a snapshot that Brown superbly tipped round down at his near post. From the resulting corner, Ian Pearce headed over, and it appeared that Hammers were beginning to exert some dominance on the game.
The hosts were clearly not going to collapse in the way that Crewe had four days earlier, though, and created the best chance of the game in the 32nd minute, when a looping cross was nodded on to player-manager Hessenthaler, who somehow volleyed high over the bar from just eight yards out.
In the 41st minute, Hammers looked to have made the breakthrough, when Defoe wriggled clear of a defender and skipped into the box before appearing to be clipped as he cut inside to shoot. Referee Armstrong waved play on, though, to ensure both sides went in level at the interval.
Half-time: Gillingham 0 West Ham United 0.
Second Half:
Gills made the livelier start to the second half and, after a couple of dangerous crosses had been cleared, they took the lead in somewhat controversial style in the 57th minute.
After Repka had been penalised for blocking the run of Spiller some 35 yards out, the Czech defender was then booked for attempting to lift the Gills midfielder off the ground and let him know what he thought of his over-the-top reaction to the challenge.
Referee Armstrong then ruled that the free-kick should be moved 10 yards forward because of Repka's protestations and things went from bad to worse for the visitors as King stepped up to fire directly into the net, low past the despairing dive of James.
Hammers almost hit back immediately when Etherington found some space on the edge of the penalty area, but the young winger fired his left-foot shot just inches wide of the post.
Repka went some way to making up for his earlier error of judgement by denying the hosts a second in the 66th minute when he fairly intercepted King's run after he had burst clear and rounded James, but as the game wore on it looked more and more likely that Brooking's 100% run in charge would be coming to an end.
The caretaker boss attempted to add some impetus with a double substitution in the 74th minute, as Anton Ferdinand and David Noble replaced Alexandersson and Horlock respectively but, in truth, neither could really provide the inspiration needed to spark a late rescue act.
Ian Pearce was thrown up front in an act of desperation with 10 minutes to go as Brooking went with a 3-4-3 formation, but just moments later the Hammers were back to a front two, as Defoe was sent off for comments made to the referee's assistant. Booked earlier in the game for a petulant foul, the England under-21 endured a difficult afternoon and allowed his frustrations to get the better of him after being penalised for a foul. His dissent earned him a straight red card.
A minute later, the final nail was banged into the coffin as substitute Benjamin wriggled free on the right and cut inside before firing in a low shot that took a wicked deflection off Dailly and trickled past the wrong-footed James into the net.
10-men Hammers had no response to that and the three minutes of added-on time only served to prolong the agony for the travelling supporters. Having struggled to come to terms with the physical and direct approach of the Kent-based outfit, Brooking's men will have to be even more mentally prepared for an intimidating trip to Cardiff City in the Worthington Cup second round on Tuesday night.