James Tarkowski struck a 98th-minute equaliser as Everton claimed a dramatic 2-2 draw against Liverpool in the final Merseyside derby at Goodison Park, stopping the visitors from going nine points clear at the top of the Premier League.
Beto had been the beneficiary from an innovative Everton set piece to put the home side ahead in the first half, but goals from Alexis Mac Allister and Mohamed Salah flipped Wednesday's match on its head.
Just as they looked set to pull further clear of title rivals Arsenal, Liverpool were hit with a stunning blow deep into stoppage time.
Tarkowski fired a terrific finish into the top-right corner to spark wild scenes among the home fans, before Curtis Jones, Abdoulaye Doucoure and Arne Slot were all shown red cards after the final whistle.
Everton climb one place in the table to go 15th, while Liverpool remain top of the pile and their bid for a 20th top-flight title continues.
How the match unfolded
Some quick thinking from Jarrad Branthwaite saw Everton take the lead on 11 minutes. He released Beto with a clever free-kick and the striker calmly slotted his finish under Alisson.
But that advantage was short-lived as Mac Allister glanced Salah's deft cross beyond Jordan Pickford and into the bottom-left corner.
A feisty first half ended level, with Liverpool going close in stoppage time as Tarkowski slid in to prevent Luis Diaz turning home after Pickford fumbled Dominik Szoboszlai's effort.
Everton started the second half well and thought they had restored their lead in the 68th minute. Branthwaite blasted home from close range, but the offside flag went up against Jake O'Brien in the build-up.
Liverpool made the most of that reprieve five minutes later, Salah converting into an empty net after Curtis Jones was denied by Branthwaite's block.
But there was to be one final twist, Tarkowski smashing home on the volley to snatch a point for Everton, with the on-field decision to award the goal confirmed following a VAR check for a possible offside.
Grand derby farewell for Goodison
David Moyes' last Merseyside derby in charge of Everton before this one was a goalless draw at Anfield in May 2013, a result that helped the Toffees finish above their neighbours in the Premier League that campaign.
The city's two clubs are now at opposite ends of the table, but Moyes ensured Everton's supporters enjoyed the final instalment of this rivalry to take place at their famous old stadium.
For long periods, it looked like being a hard luck story for the hosts. Amid a tasty atmosphere, the hosts’ energetic midfield trio of Doucoure, James Garner and Idrissa Gueye unsettled Liverpool.
Even the loss of Iliman Ndiaye, who looked distraught as he limped off to join Everton's lengthy injury list midway through the first half, did not slow Everton, who looked the likelier scorers early in the second half.
Salah's goal out of nowhere could have sucked the confidence out of them, but Tarkowski rewarded the home fans for their raucous support with a moment to remember.
Arriving unmarked onto substitute Tim Iroegbunam's flick-on, Tarkowski gave Alisson no chance with a ferocious finish into the roof of the net, prompting several over-excited fans to spill onto the playing surface amid the wild celebrations.
Many Everton supporters were still in the stands singing long after the full-time whistle sounded, and this result should provide the Toffees with a boost ahead of Saturday's trip to Crystal Palace.
Liverpool flunk derby test
Coming into the match on the back of a demoralising FA Cup elimination at the hands of Plymouth Argyle, Slot had warned Liverpool to expect one of their toughest tests at Goodison Park.
Though Mac Allister quickly got Liverpool back on level terms after the shock of Beto's opener, Liverpool looked rattled at times.
Young full-back Conor Bradley, who has enjoyed a strong campaign overall, played Beto onside for Everton's first goal. Already booked and among a tough battle at the back Slot decided to replace Bradley.
His replacement Jones played a key role in Liverpool's second goal, with his blocked shot falling nicely for Salah to prod home.
Liverpool, however, would have to survive one last push from the hosts, and neither Virgil van Dijk nor Ibrahima Konate covered themselves in glory for Tarkowski's goal.
Both Jones and head coach Slot – as well as Everton's Doucoure – then saw red after the final whistle, as players and coaches from both teams clashed.
Liverpool still boast a seven-point lead at the top of the table, but it will be interesting to see how they react to this setback when Wolverhampton Wanderers visit Anfield on Sunday.
Club reports
Everton report | Liverpool report
What the managers said
David Moyes: "Mental probably sums it up. A brilliant finish for us, to finish the last Goodison Merseyside derby and score in the last minute is in a way fitting."
Match officials
Referee: Michael Oliver. Assistants: Stuart Burt, James Mainwaring. Fourth official: Tony Harrington. VAR: Chris Kavanagh. Assistant VAR: Eddie Smart.
WHO'S GOING TO BE YOUR
MAN OF THE MATCH?
Vote at Full-time