The game finished 4-4 after 90 minutes.
Everton reached the FA Cup quarter-finals for the first time since 2016 after a thrilling 5-4 extra-time win over Tottenham at Goodison Park.
Bernard, who looked destined to leave the club less than a fortnight ago, scored the decisive goal seven minutes into the added period to overshadow the efforts of opposing substitute Harry Kane.
The England striker came off the bench to make it 4-4 in the 83rd minute with his 209th goal in 318 appearances in all competitions, taking him past Bobby Smith to become second-highest scorer in Spurs’ history behind only Jimmy Greaves (266 in 379).
Kane could not get his side over the line, however, as that honour went to the out-of-favour Brazilian whose transfer window move to Dubai-based Al Nasr fell through.
It was the culmination of a game totally unbefitting the style of managers Carlo Ancelotti and Jose Mourinho, both of whom have built their success on being defensively sound.
This was the first time a Mourinho team had conceded four goals in a game since he lost 4-0 at Chelsea as Manchester United manager in 2016 and the first time in the 981st match of his career his side had both scored and conceded four in the same game.
Richarlison netted twice for the hosts, with Dominic Calvert-Lewin and Gylfi Sigurdsson also on target while Davinson Sanchez, with one goal in his previous 137 games, also scored two in addition to Erik Lamela and Kane.
Everton went from 1-0 down to 3-1 up in the space of seven minutes and 26 seconds just before half-time but defensive frailties saw them pegged back to 3-3 and then eventually 4-4.
So when Bernard steered home a superbly-executed chip from Sigurdsson the reaction of Ancelotti, who once saw his mighty AC Milan side concede a 3-0 half-time lead in a Champions League final, was merely just to blow on his hot coffee.
How Spurs would have fared had they had Kane on from the start is open to debate but at least he was in the squad, which was not the case for Gareth Bale.
Mourinho said pre-match the Wales international was not injured but “wasn’t happy with his training session” yesterday and was “it was better to stay back and work with the sports science guys”.
That seemed at odds with Bale’s Instagram post on Tuesday of him in training with the caption “Good session today” but it did not hold Spurs back in any way as on a sub-zero night on Merseyside, Everton were caught cold.
Goalkeeper Robin Olsen saved a header from Lamela in the opening 60 seconds but they conceded within three minutes when Sanchez glanced home a Son Heung-min inswinging corner with Sigurdsson failing to even get off the ground.
Spurs had enough chances to be out of sight before Everton staged their remarkable comeback, with Son bringing a reflex save out of Olsen and also having a shot deflected onto the roof of the net by Michael Keane.
The home side looked short of ideas, despite having Calvert-Lewin’s shot brilliantly tipped onto a post by Hugo Lloris and Yerry Mina plant a good headed chance wide, but they suddenly burst into life with half-time approaching.
Pierre-Emile Hojbjerg gave the ball away deep on the left and it was quickly transferred to Calvert-Lewin who smashed in a half-volley which Lloris could not keep out for his 50th Everton goal.
While the visitors were still reeling from that, Richarlison scored with a shot through the legs of Toby Alderweireld and Sigurdsson sent Lloris the wrong way from the penalty spot after Hojbjerg clipped Calvert-Lewin as they ran into the area.
Spurs responded with the last kick of the half as Mina dangled a leg at a Son through-ball and Lamela clipped a shot over Olsen.
Eight minutes into the second half Mourinho sent on Kane but while Spurs were introducing one England striker, Everton were losing another with Calvert-Lewin heading straight down the tunnel with an injury.
Sanchez reacted quickest to when Olsen parried Alderweireld’s header to make it 3-3 before Richarlison, up front in the absence of Calvert-Lewin, clinically dispatched Sigurdsson’s through-ball from a narrow angle.
Defending set-pieces continued to be a problem for Everton so it was no surprise to see Kane diving in at the far post to nod in Son’s perfect cross after Abdoulaye Doucoure had cleared off the line from Lamela.
Spurs substitute Dele Alli’s main contribution on his first appearance since the third-round win at non-league Marine was to be booked for diving in the penalty area as the game went to extra time only for another substitute Bernard to settle it with a well-worked goal.