Richarlison scored twice before Harry Kane forced extra time and Bernard settled a Gylfi Sigurdsson masterclass at Goodison Park.
Bernard settled a topsy-turvy FA Cup thriller as Everton beat Tottenham 5-4 after extra time to claim a place in the quarter-finals.
The hosts were second best during the opening stages at Goodison Park, either side of falling behind to Davinson Sanchez's third-minute header, although Dominic Calvert-Lewin, Richarlison and Gylfi Sigurdsson – the latter from the penalty spot – were all on target in a crazy seven-and-a-half-minute spell.
Then it was time for Tottenham's comeback, with Erik Lamela reducing the arrears before half-time and Sanchez improbably poaching his second of the match.
Richarlison arrowed a high-quality finish beyond Hugo Lloris on the angle to convert Sigurdsson's brilliant 68th-minute through ball and, although Harry Kane had the desired effect from the bench to bring extra time, fellow substitute Bernard had the final word.
Tottenham's dominant start gave little indication of what was to come, with Lamela's header forcing a superb reaction stop from Robin Olsen, while Lucas Moura blazed the follow-up over.
Everton did not heed that warning and stood passively as Sanchez headed in Son Heung-min's corner.
Olsen was alert to deny Steven Bergwijn at close quarters after the half-hour mark and his team-mates soon turned the contest on its head.
Lloris kept out a dangerous Calvert-Lewin effort earlier in the half, despite a slight deflection off Ben Davies, but the England striker's sweetly struck 36th-minute effort on the end of Sigurdsson's clever flick proved too hot to handle.
Calvert-Lewin, who limped off early int the second half with a suspected hamstring injury, turned provider with a slick backheel of his own for Richarlison to smash in from the edge of the penalty area with similar venom.
Pierre-Emile Hojbjerg was culpable on the first goal and fouled Calvert-Lewin for Sigurdsson to make it 3-1 from the spot.
That could have been game over, but the defending remained generous and Lamela played a one-two with Son that Yerry Mina failed to cut out and finished with aplomb.
Mina's Colombia team-mate Sanchez prodded in when Olsen kept out Toby Alderweireld's 57th-minute header – Everton's set-piece defending again leaving plenty to be desired.
But there was only fine attacking at which to marvel when Sigurdsson and Richarlison combined, the Brazil forward whipping home a wonderful left-footed finish.
Abdoulaye Doucoure's goal-line clearance to deny Lamela a brace was in vain as Kane converted the latest fine Son cross with a diving header.
Another repeated theme decided matters in the seventh minute of extra time, when Sigurdsson produced an exquisite drag-back and chip for Bernard to lash past Lloris.
What does it mean? Cup specialist Ancelotti lets Everton dream
Carlo Ancelotti's succession of appointments to the top jobs in European football mean four league titles represents a slightly meagre return.
However, he comes alive in the cup competitions and his ice cool non-celebration for Bernard's winner spoke of a man who has seen all this and more many times before.
While a strong cup run – one that might yet end Everton's 26-year trophy drought – is what we have come to expect from Ancelotti, these 120 minutes of rampant disorder were not from the Jose Mourinho playbook. Another indication, perhaps, of this Tottenham tenure spinning away from his once authoritative grasp.
Sigurdsson and Richarlison step up
James Rodriguez has shouldered the creative burden for Everton this season and sat out with a calf injury on Wednesday.
Ex-Spurs playmaker Sigurdsson produced his vintage best with three delightful assists in his absence, while an unfussy conversion from the spot was a rare moment of normality.
Richarlison's second was probably the pick of the nine. Everton's number seven scored from both of his shots in target and Ancelotti will have been encouraged to see his side retain a decisive threat after Calvert-Lewin departed.
Making Emile of it
The list of defensive crimes was long but the usually reliable Hojbjerg giving the ball away to spark Spurs' first-half meltdown stood out.
The midfielder's three interceptions and 11 instances of gaining possession were the best of anyone in a white shirt but not enough to undo the damage done.
Tottenham travels to in-form Premier League leaders Manchester City on Saturday. After a 3-3 draw at Manchester United and this latest epic, how Everton's Sunday fixture against Fulham might play out is anyone's guess.