Robin van Persie scored in stoppage time as Manchester United remained in the FA Cup by the skin of their teeth and denied West Ham a famous win.
Tom Cleverley gave the visitors the lead when he sidefooted in before James Collins headed the equaliser, his first goal since returning to the club.
Collins gave the Hammers the lead with another header after the break.
With seconds remaining, Van Persie latched on to Ryan Giggs's through-ball to earn the visitors a replay.
No bore draws
- Only two of Manchester United's last 32 games in all competitions have ended level after 90 minutes
Although the Premier League leaders left it very late, there was something inevitable about the final act given the visitors' reputation for recovering the most unpromising of situations.
It was, however, heartbreaking for West Ham, who few would have said did not deserve their place in the fourth round following a mature performance.
Both sides fielded strong line-ups, while the visitors also named an impressive bench that included Rio Ferdinand, Antonio Valencia, Ryan Giggs, Ashley Young and Van Persie.
Welbeck took the Dutchman's place in the starting XI and his pace was a worry in the opening 45 minutes, but it was the speed of thought of strike partner Hernandez that led to the opening goal for United.
The Mexican has scored three in the last three, but was provider on this occasion when he darted down the right and delivered a pacey ball into the area for midfielder Cleverley, who opened his body up and guided a firm strike past Jussi Jaaskelainen.
His goal delighted the travelling fans and was warmly applauded by match attendee and ex-Old Trafford favourite David Beckham, to whom the goalscorer has been likened.
- In the last three competitive meetings between West Ham and Manchester United at Upton Park, four different Hammers players have scored a brace
A few moments earlier, defender Nemanja Vidic had a header cleared off the line by Daniel Potts, while West Ham's Alou Diarra saw his headed effort cleared from danger by a well-positioned Paul Scholes.
That aerial threat has benefitted Sam Allardyce's side this season, and five minutes after the opener they were level via those means when Collins scored his first goal since returning to the club from Aston Villa.
Joe Cole, making his second debut for the Hammers, roamed from wing to wing during the match and bent in a delightful ball from the left that was powered in by the centre-back off his forehead.
Ferguson's side made another lively start after the break and Cleverley should have at least hit the target instead of thrashing over when the ball came to him at the edge of the area.
Although the tactics seemed set right, Ferguson's defenders appeared to allow Cole more room than should have been afforded as the game went on.
Coming up to the hour, Cole was again allowed space to deliver. And on almost the same spot from which he had supplied the cross for West Ham's first goal, he found his partner-in-crime Collins, whose flicked header was beautifully directed into the corner.
Ferguson threw on the bigger guns - Van Persie and midfielder Antonio Valencia - to try to remain in a competition his side last won in 2004.
As four minutes of stoppage time were announced, the Hammers must have entertained the thought they had the 11-time winners beaten, but Van Persie changed all that as he brilliantly controlled Giggs's lofted ball and rifled in.
West Ham United
- 22 Jaaskelainen
- 05 Tomkins
- 19 Collins
- 20 Demel
- 33 Potts
- 04 Nolan
- 10 Collison Booked
- 23 Diarra (Noble - 73' )
- 26 J Cole (Taylor - 78' )
- 09 C Cole
- 12 Vaz Te (Jarvis - 61' )
- 30 Spiegel
- 02 Reid
- 27 Spence
- 07 Jarvis
- 14 Taylor
- 16 Noble
- 47 Lee
- 01 De Gea
- 02 Rafael
- 06 Evans
- 12 Smalling (Giggs - 78' )
- 15 Vidic Booked
- 28 Buttner
- 22 Scholes Booked (Valencia - 68' )
- 23 Cleverley
- 26 Kagawa
- 14 Hernandez (Van Persie - 68' )
- 19 Welbeck
- 13 Lindegaard
- 05 Ferdinand
- 07 Valencia
- 11 Giggs
- 18 Young
- 20 Van Persie
- 27 Macheda
Live Text Commentary
Full Time The final whistle is blown by the referee.90:00 +3:49
Effort on goal by Antonio Valencia from deep inside the penalty area misses to the right of the goal.90:00 +3:22
Outswinging corner taken from the left by-line by Ryan Giggs, clearance made by Guy Demel.90:00 +0:22
Ryan Giggs provided the assist for the goal.90:00 +0:22 Goal scored
Goal! - Robin van Persie - West Ham 2 - 2 Man Utd Robin van Persie scores a goal from inside the box to the bottom left corner of the goal. West Ham 2-2 Man Utd.89:37
Header from close range by Ryan Giggs clears the bar.87:51
Close range shot by Carlton Cole misses to the left of the goal. Daniel Potts fouled by Antonio Valencia, the ref awards a free kick. James Collins restarts play with the free kick.82:58
Free kick taken by Mark Noble. Effort on goal by Jack Collison from just inside the box goes harmlessly over the target.82:58 Booking
Booking Nemanja Vidic is shown a yellow card for unsporting behaviour.82:53
Nemanja Vidic challenges Matthew Jarvis unfairly and gives away a free kick.80:04
Corner from the right by-line taken by Robin van Persie, clearance by Guy Demel. Ryan Giggs takes a short corner.78:22
Mark Noble fouled by Alexander Buttner, the ref awards a free kick. Jussi Jaaskelainen takes the free kick.77:08 Substitution
Substitution Joe Cole goes off and Matthew Taylor comes on.77:08 Substitution
Substitution (Man Utd) makes a substitution, with Ryan Giggs coming on for Chris Smalling.71:54 Substitution
Substitution Alou Diarra goes off and Mark Noble comes on.71:54
Close range headed effort by Danny Welbeck clears the crossbar.67:19
Outswinging corner taken from the left by-line by Alexander Buttner, Header from close in by Robin van Persie misses to the left of the target.67:19 Substitution
Substitution Paul Scholes leaves the field to be replaced by Antonio Valencia.67:19 Substitution
Substitution Robin van Persie comes on in place of Javier Hernandez.60:06 Substitution
Substitution Matthew Jarvis is brought on as a substitute for Ricardo Vaz Te.
Assist by Joe Cole.58:52 Goal scored
Goal! - James Collins - West Ham 2 - 1 Man Utd James Collins finds the net with a headed goal from inside the box. West Ham 2-1 Man Utd.58:27
Jack Collison takes a inswinging corner from the left by-line played to the near post, Chris Smalling manages to make a clearance.57:09
Shinji Kagawa takes a shot. Blocked by James Tomkins.56:45
Carlton Cole takes a shot. David De Gea makes a save.49:36
James Tomkins takes a shot. Save by David De Gea. The offside flag is raised against Javier Hernandez. Indirect free kick taken by James Collins.48:46
Free kick awarded for an unfair challenge on Carlton Cole by Nemanja Vidic. The free kick is swung in right-footed by Joe Cole.47:17
Effort on goal by Tom Cleverley from just inside the box goes harmlessly over the target.46:37
Rafael Da Silva takes a shot. Blocked by James Collins.45:46
Foul by Javier Hernandez on James Tomkins, free kick awarded. James Collins restarts play with the free kick.45:13
Effort from just outside the box by Joe Cole goes over the bar.45:01
The second half has started.45:00 +2:23 Half time
Half Time The half-time whistle blows.45:00
Rafael Da Silva is adjudged to have handled the ball. Jussi Jaaskelainen restarts play with the free kick.43:03
Effort on goal by Ricardo Vaz Te from just inside the penalty box goes harmlessly over the target.42:26
Chris Smalling gives away a free kick for an unfair challenge on Ricardo Vaz Te. James Collins takes the direct free kick.41:59
Free kick awarded for a foul by Alou Diarra on Danny Welbeck. Alexander Buttner takes the free kick.40:05
Shot from just outside the area by Ricardo Vaz Te goes over the bar.39:50
Rafael Da Silva gives away a free kick for an unfair challenge on Daniel Potts. Free kick taken by Daniel Potts.38:51
Paul Scholes concedes a free kick for a foul on Kevin Nolan. Jack Collison delivers the ball from the free kick right-footed from right wing, clearance made by Danny Welbeck.37:31
Direct free kick taken by Danny Welbeck.37:31 Booking
Booking Jack Collison is shown a yellow card for unsporting behaviour.37:19
Free kick awarded for an unfair challenge on Rafael Da Silva by Jack Collison.35:48
Danny Welbeck takes a shot. Jussi Jaaskelainen makes a save.34:44
Corner from the right by-line taken by Jack Collison, clearance by Javier Hernandez.33:55
Shot from long distance by Javier Hernandez misses to the right of the target.33:26
Unfair challenge on Nemanja Vidic by Carlton Cole results in a free kick. Paul Scholes takes the free kick.31:22
Free kick awarded for a foul by Javier Hernandez on Guy Demel. Free kick crossed right-footed by Joe Cole.28:11
Effort on goal by Alou Diarra from long range goes over the bar.26:51
The assist for the goal came from Joe Cole.26:51 Goal scored
Goal! - James Collins - West Ham 1 - 1 Man Utd James Collins finds the net with a headed goal from close range. West Ham 1-1 Man Utd.26:10
Free kick awarded for a foul by Nemanja Vidic on Carlton Cole. Free kick crossed by Jack Collison.23:40
Free kick taken by Joe Cole. Ricardo Vaz Te takes a shot. Save by David De Gea.23:40 Booking
Booking Paul Scholes booked.23:22
Free kick awarded for an unfair challenge on Jack Collison by Paul Scholes.22:09
Javier Hernandez provided the assist for the goal.22:09 Goal scored
Goal! - Tom Cleverley - West Ham 0 - 1 Man Utd Goal scored by Tom Cleverley from deep inside the penalty box to the bottom right corner of the goal. West Ham 0-1 Man Utd.20:48
Outswinging corner taken right-footed by Jack Collison, Tom Cleverley makes a clearance. Kevin Nolan is ruled offside. Free kick taken by David De Gea.20:25
Joe Cole takes a shot. Jonny Evans gets a block in.18:04
Alou Diarra concedes a free kick for a foul on Rafael Da Silva. Alexander Buttner takes the direct free kick. Outswinging corner taken from the left by-line by Alexander Buttner, Nemanja Vidic takes a shot. Daniel Potts makes a clearance.15:41
The assistant referee signals for offside against Javier Hernandez. Free kick taken by Jussi Jaaskelainen.14:26
Javier Hernandez concedes a free kick for a foul on Daniel Potts. James Collins restarts play with the free kick.12:52
Shot by Jack Collison from outside the box goes over the net.10:38
Corner taken right-footed by Jack Collison from the left by-line, Guy Demel takes a shot. Clearance made by Paul Scholes. Carlton Cole has a header from inside the six-yard box and clears the crossbar.6:04
Chris Smalling challenges Joe Cole unfairly and gives away a free kick. Jussi Jaaskelainen restarts play with the free kick.3:47
Free kick awarded for a foul by Joe Cole on Chris Smalling. Free kick taken by Paul Scholes.0:00
The match gets underway.
Live data and text provided by our data suppliers