Jermain Defoe was sent off as Trevor Brooking's 100% record in temporary charge of West Ham came to an end against Gillingham at Priestfield.
Defoe, who had been booked for a reckless challenge on Nayron Nosworthy just seconds into the second half, was sent off in the 80th minute for abusive language after he was the victim of a tackle from Wayne Brown.
And moments after Defoe lost his discipline, West Ham effectively lost the game as on-loan Trevor Benjamin sealed the points for Gillingham with a deflected effort to add to Marlon King's earlier strike.
The game began brightly, with Gills defender Chris Hope called into action in the third minute to deny Defoe with a last-ditch tackle.
Mali striker Mamady Sidibe almost marked his return from international duty with a goal moments later, but he miscued from six yards and his shot went tamely wide.
West Ham hit back, with Ian Pearce heading wide and Kevin Horlock seeing a sweetly-struck shot blocked by Nosworthy, while at the other end Hessenthaler volleyed wide.
But the Gills took a deserved lead just before the hour as King netted his third goal in five games with an unstoppable 25-yard free-kick which whistled past David James.
Benjamin was introduced with 20 minutes remaining, and he was straight into the action, firing over the crossbar from 25 yards with his first touch.
With just under 10 minutes remaining, Defoe reacted angrily to Brown's late challenge, and after a verbal tirade aimed at the linesman, was given his marching orders.
This gave the home side renewed impetus, and from their very next attack Benjamin capped his debut with a goal.
Gillingham: Jason Brown, Nosworthy, Cox, Hope, Wayne Brown, Hessenthaler, Saunders, Spiller, Shaw, King, Sidibe. Subs: Bossu, Hills, Smith, Benjamin, Perpetuini.
West Ham: James, Repka, Dailly, Pearce, Lee, Etherington, Horlock, Quinn, Alexandersson, Connolly, Defoe. Subs: Ferdinand, Sofiane, Kilgallon, Noble, Bywater.
Referee: P Armstrong (Berkshire).