West Ham Utd 2 Birmingam City 1: Ben Foster blundered as 10-man West Ham survived a moment of madness from Victor Obinna to beat Birmingham in the first leg of their Carling Cup semi-final.
England goalkeeper Foster allowed a powder-puff shot from substitute Carlton Cole to squirm through his legs after Obinna looked to have cost the Hammers dear by crazily kicking Sebastian Larsson in the groin.
Rightly sent off, Obinna had been central to a sterling first half from the home side, which saw Mark Noble deservedly put them ahead, arguably with the help of another Foster error.
Former West Ham trainee Liam Ridgewell levelled after the break and the visitors looked set to go on and win before Foster's howler.
The prospect of West Ham's first League Cup final for 30 years had failed to quell the speculation over manager Avram Grant's future, with some reports suggesting even a win would not be enough to spare him the axe.
Despite Birmingham being only two points clear of the Hammers, boss Alex McLeish was under no such pressure as he looked to lead them to their first final since 2001.
But his team did not start like that as West Ham bossed the first half virtually from start to finish.
Captain Matthew Upson set the tone from the unfamiliar position of left-back, an inspired selection by Grant as he bombed forward at will.
The former Birmingham star even forced the first of a number of uncomfortable saves from Foster, with a rising near-post drive after his own cross had come back to him off Obinna.
Noble pounced in the 13th minute, lashing in from the narrowest of angles with Foster's view blocked by team-mate Scott Dann.
West Ham, who thrashed Manchester United 4-0 in the previous round, were pegged back when Ridgewell powered home in the 56th minute.
Obinna then pressed the self-destruct button and referee Phil Dowd brandished a red card.
West Ham, though, grabbed the winner 12 minutes from time when Cole's tame effort went under the hapless Foster.