After more than 210 minutes over two matches, Angelo Ogbonna finally settled West Ham’s FA Cup fourth-round tie with Liverpool, heading the London side into the last 16 in the dying seconds of extra time at Upton Park on Tuesday.

The hosts appeared the side keenest to hang on for penalties after Liverpool went close on a number of occasions in the added 30 minutes. But from Dimitri Payet’s free-kick swung deep into the box, the Italian defender rose highest to book West Ham a trip to Blackburn Rovers.

After a scoreless result in the first match at Anfield 10 days ago, there was far more entertainment on show in the replay. And, despite making 10 changes to the team that drew 2-2 with Sunderland on Saturday, it was Liverpool that had the better of proceedings after Philippe Coutinho had equalized Michail Antonio’s goal at the start of the second half. For Jurgen Klopp, there were some encouraging performances from a young side going up against a strong West Ham lineup, but there will have been plenty of frustration, too, particularly on a night when he was forced to try and contain his emotions just days after undergoing surgery.

Chances came the way of both teams in an action-packed first half that saw the woodwork hit three times. Joey O’Brien tested the foundations of the goal first, getting forward from right-back and striking the post after his shot took a deflection off of makeshift center-back Lucas Leiva. It was Liverpool’s turn next, with Winston Reid narrowly escaping punishment for giving the ball away when Coutinho’s effort clattered back off Darren Randolph’s left-hand post. Randolph was an active participant moments later when denying Christian Benteke’s header after some slack marking at a corner.

The goalmouth action was to continue for the rest of the period. Payet showed a rare glimpse of his quality on an a largely quiet night for the Frenchman with a superb curling free-kick that may have just got a crucial touch off Simon Mignolet’s glove on its way onto the post. And seconds later Mignolet was up to stop a header from Antonio. But right on the stroke of halftime, it was West Ham that got the breakthrough. There was plenty of quality involved, too, with Enner Valencia swinging in a superb left-footed cross that Antonio met with a textbook volley into the net.

The entertainment dipped little after the restart. Three minutes in, Liverpool were level thanks to a moment of class from Coutinho, cleverly striking a low free-kick that caught out West Ham’s jumping wall and left Randolph unsighted.

Midway through the period, West Ham will rightly feel they should have been handed a golden chance to go back in front. Looking to turn in Antonio’s cross from close range, Valencia was clearly tugged back by Liverpool defender Tiago Ilori, but the appeals for a penalty went unanswered.

With neither team seemingly enthusiastic about adding another 30 minutes to their heavy workload, both managers threw on attackers in the closing stages in search of a regulation-time winner. But despite the arrival of Andy Carroll and Victor Moses for West Ham and Daniel Sturridge and Divock Origi for Liverpool, and eight minutes added on, largely because of an injury to Cheikhou Kouyate, neither team could find a winner.

A winner is what Benteke really should have provided in extra time. But just a minute after his low volley skidded wide of the post, the man who sits second only to Carroll on Liverpool’s list of most expensive ever signings was denied by Randolph when clean through on goal. With Liverpool continuing to push in vain for a decisive goal for the rest of the period, Ogbonna’s late, late intervention means Benteke’s misses are unlikely to be forgotten.