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.