Penalties were needed in the third-round replay at Upton Park following a dramatic 2-2 draw after extra time.
Enner Valencia gave West Ham the lead early in the second-half and things got worse for the visitors when Aiden McGeady was sent off for two bookable offences.
Roberto Martinez threw on Kevin Mirrallas and he was the difference, firing a magical free-kick past Adrian with just eight minutes remaining to send the game into extra time.
Romelu Lukaku gave his side first blood after the restart, firing home Mirrallas??? cross, but Martinez???s side could not hold on for victory.
Allardyce brought on Carlton Cole as his side went in search of an equaliser and the move worked as the substitute stabbed home James Tomkins’ knock down with his first touch to take the game to penalties.
And Adrian was the hero for the home side, saving Steven Naismith???s spot kick before scoring the winning penalty himself after Everton goalkeeper Joel Robles missed his spot kick.
West Ham???s reward after a pulsating 120 minutes of football is a trip to Ashton Gate to face in-form League One side Bristol City.