Match ends, West Ham United 2, Liverpool 1.
Angelo Ogbonna's extra-time header put West Ham into the last 16 of the FA Cup with a dramatic fourth-round replay win against Liverpool.
The Hammers led before half-time when Michail Antonio guided in Enner Valencia's cross at the far post.
Liverpool responded shortly after the restart when Philippe Coutinho's low free-kick sneaked under the home wall.
Both sides hit the woodwork in an open tie, before Ogbonna met Dimitri Payet's free-kick to delight the home fans.
The Hammers will visit Championship side Blackburn in the fifth round on Sunday, 21 February.
Magic of the cup?
West Ham manager Slaven Bilic has said he would rather win the FA Cup than finish in the Premier League top four, and he showed his intent by picking a near full-strength side against an inexperienced Liverpool team.
Reds counterpart Jurgen Klopp, as he had in his previous three FA Cup matches, rang the changes with only goalkeeper Simon Mignolet surviving from Saturday's Premier League draw against Sunderland.
But any worries - for the neutral observer, at least - that the hosts would dominate their youthful opponents proved unfounded.
The two sides were evenly matched throughout the 120 minutes as a high-tempo game, containing plenty of goalscoring chances and drama, provided a sharp contrast to the dour 0-0 draw at Anfield.
Either side could have nicked an extra-time winner, with Christian Benteke missing three clear-cut opportunities for Liverpool.
And former Juventus defender Ogbonna's first Hammers goal provided the perfect finale for the hosts in what might be the final FA Cup tie at the Boleyn Ground before their move to the Olympic Stadium.
Hammers up for the cup?
West Ham are three-time winners of the FA Cup, but have not lifted the trophy since Trevor Brooking's famous header gave them victory in the 1980 final.
But with Bilic keen to focus on the competition, could he lead the east London club to silverware in his first season as Hammers boss?
The Croat will not publicly admit it, but he must realise his team have a great chance of reaching the last eight as they face a Blackburn side winless in eight league matches and in the lower reaches of the Championship.
France international Dimitri Payet will be central to their ambitions of a possible run to Wembley, with the mercurial midfielder again instrumental in this victory.
The 28-year-old, who the Hammers want to sign an improved deal, outlined his worth by starting the move that led to Antonio's goal and supplying the teasing free-kick that Ogbonna converted.
Benteke to blame?
Since his £32m summer arrival from Aston Villa, Benteke has failed to win over many Liverpool fans, who have questioned the wisdom in spending so much on a striker who has struggled to fit into the Reds' system.
And the Belgian missed the chance to win over the doubters by firing Liverpool, seven-time winners of the FA Cup, past the Hammers.
Benteke had nine efforts at goal - three times as many as any other player - but extended his goalless run to 11 matches in 2016.
Hammers keeper Darren Randolph denied him from close range in both halves of normal time, but Benteke should have scored when put clean through in extra time.
However, he could only shoot at the legs of the Republic of Ireland international - a miss which proved costly.
"It's not the nicest moment in his career but he has to work hard," said Klopp.
"He wants to score and we need him to score. We will work on it in the days, weeks and months."
Sturridge return boosts Liverpool
Despite the defeat, there were some positives for Liverpool fans - most notably Daniel Sturridge returning from a hamstring injury to make his first appearance since early December.
Sturridge has spent almost 55% of his time at Anfield injured, but once again showed how important he could be if he manages to stay fit.
The England international gradually grew into the game after arriving as a 59th-minute substitute, showing glimpses of neat footwork and his sharp eye for goal.
His best opportunity came early in the second half of extra time, when he picked the ball up near the halfway line before driving forward unopposed and fizzing a shot inches over the Hammers crossbar.
Too early to start thinking of an England recall?
Man of the match - Michail Antonio (West Ham)
Back to Premier League action. Sixth-placed West Ham go to relegation battlers Norwich on Saturday, while ninth-placed Liverpool visit bottom side Aston Villa on Sunday.
Stats you need to know
- Liverpool played their 40th game in all competitions in 2015-16, more than any other Premier League team
- Philippe Coutinho's goal was Liverpool's first in 318 minutes of action against West Ham in all competitions this season
- The Hammers have lost just one of their past 11 FA Cup games at home, winning six and drawing four
- West Ham's win was their first in eight FA Cup meetings with the Reds, drawing three and losing four
- Benteke has gone 11 games without scoring for Liverpool in all competitions, mustering 30 shots in those matches
- 17O'BrienSubstituted forMosesat 83'minutes
- 2ReidSubstituted forCollinsat 65'minutes
- 8KouyatéSubstituted forCarrollat 75'minutes
- 30AntonioBooked at 87mins
- 11E Valencia
- 44B Smith
- 68ChirivellaSubstituted forMilnerat 101'minutes
- 35StewartBooked at 26mins
- 53Vilaca TeixeiraSubstituted forOrigiat 59'minutes
- 10CoutinhoSubstituted forSturridgeat 59'minutes
- 3Enrique Sanchez Diaz
- Roger East
- Shots on Target
Second Half Extra Time ends, West Ham United 2, Liverpool 1.
Goal! West Ham United 2, Liverpool 1. Angelo Ogbonna (West Ham United) header from the left side of the box to the bottom right corner. Assisted by Dimitri Payet with a cross following a set piece situation.
Foul by Lucas Leiva (Liverpool).
Enner Valencia (West Ham United) wins a free kick on the right wing.
Attempt blocked. Christian Benteke (Liverpool) header from the centre of the box is blocked. Assisted by James Milner with a cross.
Corner, Liverpool. Conceded by Pedro Obiang.
Attempt blocked. Jon Flanagan (Liverpool) header from the right side of the box is blocked. Assisted by James Milner with a cross.
Corner, Liverpool. Conceded by James Collins.
Attempt blocked. Daniel Sturridge (Liverpool) right footed shot from very close range is blocked. Assisted by Jon Flanagan.
Attempt blocked. James Milner (Liverpool) right footed shot from outside the box is blocked. Assisted by Tiago Ilori.
Corner, Liverpool. Conceded by Michail Antonio.
Offside, West Ham United. James Collins tries a through ball, but Andy Carroll is caught offside.
Delay over. They are ready to continue.
Delay in match Enner Valencia (West Ham United) because of an injury.
Foul by Lucas Leiva (Liverpool).
Angelo Ogbonna (West Ham United) wins a free kick in the attacking half.
Attempt blocked. Enner Valencia (West Ham United) right footed shot from outside the box is blocked. Assisted by Pedro Obiang.
Attempt missed. Christian Benteke (Liverpool) right footed shot from outside the box misses to the right. Assisted by Jon Flanagan.
Foul by Jon Flanagan (Liverpool).