The win ends a dismal run for the Toffees, who had only one win in their last nine.
Spurs looked to have done enough for the victory with a Clint Dempsey beauty from 20 yards, but two goals in two minutes at the death from Seamus Coleman crosses, firstly a Steven Pienaar header then Jelavic’s tap in, stunned the visitors.
With Gareth Bale absent for the first time this season for Spurs in the league, Everton took the game to their visitors and controlled much of the first half but without causing Tottenham’s keeper Hugo Lloris any real problems.
Everton substitute Steven Naismith almost put the hosts in front within minutes of the restart, but he couldn’t direct Leighton Baines’s off-target shot into the net.
Then with 15 minutes to go Dempsey found himself in space and struck sweetly into the top corner of Tim Howard’s goal, creating the first cheers from the travelling fans, who had had nothing to sing about before then.
Gylfi Sigurdsson was inches from doubling the lead. His 20-yard shot beat Howard, but hit the bar. However with five seconds of normal time remaining, Steven Pienaar threw himself at Coleman’s cross to head the hosts level and the crowd sensed more to come.
They were proved right as Jelavic stayed on-side to poke in another Coleman cross to complete a famous victory.