The Hammers were left shell-shocked at the break as they found themselves 3-1 behind.
Jordon Mutch struck first with an impressive solo goal for the visitors, bamboozling Abdoulaye Faye with some trickery before firing a shot past an unsighted Rob Green. And Blues doubled their advantage moments later when Marlon King beat the offside trap before keeping his cool to slot home.
The home supporters were beginning to voice their displeasure before Vaz Te headed in his fourth goal in as many games in first half stoppage time.
However, Birmingham went straight up the other end and restored their two-goal advantage when Chris Burke fired a volley into the ground which somehow bounced into Green's net.
Carlton Cole pulled one goal back before Vaz Te lashed in the equaliser from the spot which was awarded after Henri Lansbury's shot hit Burke's arm.