Angelo Ogbonna scored in stoppage time of extra time to send West Ham United into the fifth round of the FA Cup at Liverpool's expense this evening.
Nothing separated the two sides for more than 210 minutes over their two meetings until Ogbonna popped up with a late header to seal a 2-1 win and set up a showdown with Blackburn Rovers later this month.
It was Liverpool who made the more confident start to the match, and they threatened first when Christian Benteke peeled away at the back post from a corner, only to be thwarted by Darren Randolph from a tight angle.
West Ham responded by going up the other end and coming within inches of taking the lead in their first meaningful attack of the game as Joey O'Brien's shot deflected off Lucas Leiva and against the upright with Simon Mignolet beaten.
Much of Liverpool's joy in the first half came down the left flank, with crosses from Brad Smith creating openings for Jordon Ibe and Joao Teixeira, but both went begging as Ibe's touch let him down and Teixeira drilled the ball narrowly wide of the target.
The woodwork then came to the hosts' rescue shortly after the half-hour mark when the fit-again Philippe Coutinho and Benteke combined in a three-on-two situation, with the former stabbing his effort against the post.
A follow-up effort from Kevin Stewart deflected behind for a corner, and from the resulting delivery Benteke again peeled off his man, only to be denied by Randolph once more.
Mignolet was called into action at the other end just a few minutes later when West Ham were awarded a free kick in a very dangerous position, with the Belgian at full stretch to tip Dimitri Payet's effort onto the post before recovering in time to also keep out Michail Antonio's follow-up header.
There was nothing he could do to keep out Antonio right on the stroke of half time, however, as the winger opened the scoring against Liverpool at Upton Park for the second time this season, smashing a first-time volley into the far corner having been found by Enner Valencia's cross.
Liverpool didn't take long to respond after the interval, however, levelling things up within three minutes of the restart as Coutinho marked his return to the starting XI with a goal.
Benteke won a free kick right on the edge of the West Ham box and, instead of trying to get the ball up and back down in time, Coutinho instead rolled his shot underneath the jumping wall and past a statuesque Randolph.
The visitors threatened to take the lead shortly afterwards when Pedro Obiang threw himself in the way of a Benteke effort after the hosts could only clear Smith's cross as far as the Belgian striker.
There was an opening at the other end moments later as Aaron Cresswell scuffed an effort when well placed, and the hosts should have had a penalty in the 66th minute when Tiago Ilori got away with pulling Valencia down after good work from Antonio.
Both keepers were called into action in the closing stages as the match edged towards extra time, with Randolph denying a Benteke free kick and Mignolet getting across to keep out Mark Noble's speculative long-range strike.
Ibe brought another stop from Randolph in the first of eight minutes injury time, but despite both sides going for a late winner, neither were able to find it as the match went to extra time.
Mignolet was the first to be worked in the additional 30 minutes when he parried Noble's effort away, but Liverpool should have taken the lead moments later when Benteke squandered two clear chances in quick succession.
The first saw him fire a first-time volley narrowly wide of the target as the ball dropped to him inside the area, before being denied by Randolph yet again when clean through on goal with only the keeper to beat.
The Belgian wasted another opening before the halfway stage in extra time when he nodded over the crossbar, while in the opening minutes of the second half the returning Daniel Sturridge was allowed to bring the ball forward before firing one narrowly too high.
The visitors' profligacy would come back to haunt them, however, as West Ham stole the victory with penalties looming when Ogbonna climbed highest in the area to nod Payet's free kick home and seal his side's place in the last 16.