When the decisive moment arrived, almost six minutes into stoppage time, Jürgen Klopp was on the pitch, David Pleat-style minus the brown shoes, and the victory run took him all the way to his goalkeeper, Alisson, some 40 yards from Liverpool’s dugout. It was bedlam, absolute bedlam, and amid all the chaos an unlikely hero had emerged in the shape of Divock Origi, scoring a late, dramatic winner beneath the Kop with one of the more eccentric and ecstatic goals of any Merseyside derby.

In the long history of this fixture the supporters of Liverpool will cherish that freakish moment when Virgil van Dijk tried his luck with a 25-yard volley in the final seconds and miscued it so badly that there was an audible groan from the home crowd, as if they suspected that was their final chance to win. Van Dijk turned away in disgust, furious with himself for not making a cleaner connection. Except the spin on the ball took it high and then down and, suddenly, Jordan Pickford in the Everton goal was in trouble. The ball dropped on to the crossbar and, astonishingly, bounced on top of the woodwork again. Pickford was flailing and Origi, an 84th-minute substitute, was there to apply the finishing touch.

And Klopp was off, pumping his fists, celebrating so wildly he had a moment of remorse afterwards and claimed he had apologised to Marco Silva, the Everton manager, in case it seemed disrespectful. Silva, intriguingly, seemed nonplussed, saying there had been zero apology.

That aside, how vital could that goal be? Without it Liverpool would have left the pitch knowing Manchester City’s vastly superior goal difference at the top of the Premier League put the champions, in effect, five points clear. Origi’s winner dramatically changes the picture again. It was an incredible way to settle any match, let alone a derby, and Klopp’s celebration told its own story.

For Everton it was a crushing way to lose, culminating in a crestfallen Pickford holding up an apologetic hand to the corner of Anfield Road where their supporters were congregated. For long spells Everton had been superb, attacking stylishly, defending stubbornly and playing with an ambition that has rarely been associated with their visits to Anfield since the turn of the century. The bottom line, however, is that their miserable run against Liverpool is now 16 league games without a win, going back to October 2010, and to lose in such devastating circumstances will make it little consolation that they had contributed so richly to an absorbing contest.

Pickford’s role in the goal will inevitably be scrutinised and, plainly, the England international goalkeeper badly misjudged the trajectory of the ball. He was not alone, in fairness, but once he realised it was not going into the crowd he should probably have tried to tip the ball over for a corner. Maybe, so late into the game, he decided in that split second he would rather catch it. But he could not manage either, his fingertips helping to keep the ball in play, and his net was hopelessly exposed when – almost in slow motion – the ball dropped to Origi to nod it over the line.

Until that point, it would have been difficult to begrudge Everton a share of the points. Liverpool’s inability to break them down had already prompted Klopp to substitute Mohamed Salah with a quarter of an hour to play. Roberto Firmino was also removed, allowing Origi on the pitch. Sadio Mané and Xherdan Shaqiri had squandered Liverpool’s better opportunities and when Origi had his first chance to be the hero, in the 87th minute, he could not take it, turning a close-range shot against the crossbar.

If nothing else, it must be encouraging for Everton’s supporters that their team could play so enterprisingly at the home of their nearest rivals. Too often Everton have made the trip across Stanley Park and seemed painfully aware of the imbalance of talent between the two sides. Not here, though. Everton played with spirit, ambition and courage on the ball, as if affronted by the fact they had not won a league game here since 1999.

As they reflect on how brutal this sport can be, Silva and his players will also think back to a number of scoring chances, particularly in the opening half. Yerry Mina headed the game’s first clear opportunity wide, six yards out, from a free-kick. Yet the biggest let-off for Liverpool came in the 20th minute when Alisson saved a point-blank header from André Gomes and, among a scramble of bodies, Joe Gomez managed to hook the ricochet off the goal-line. Gylfi Sigurdsson turned the loose ball against the post and that was a key moment. Gomes played well but really ought to have done better with the initial opportunity.

Ultimately, though, this match will always be remembered for what happened in the 96th minute – an injury to Idrissa Gueye had delayed the game after four minutes of stoppages were shown on the electronic board – and the wild scenes that followed. Silva tried to console Pickford at the final whistle but the damage was done and Anfield celebrated an extraordinary victory.