The Magpies went into the break with a half-time lead, after Robbie Elliott put them ahead after 2 minutes.
Despite total domination from Newcastle, Leicester turned the game on its head after Matt Elliott headed in a 55th minute equaliser.
Steve Claridge and Emile Heskey stunned the St. James' Park crowd with second half goals to give the Foxes a surprising 3-1 lead.
After David Ginola was brought down on the edge of the area, the previously anonymous Alan Shearer smashed in the free-kick.
The Geordie favourite scored an unlikely equaliser with seven minutes remaining, before he latched onto a Lee Clark cross to win the game for Newcastle in injury time.