The Brazilian midfielder cancelled out Ademola Lookman’s opener on the half-hour mark before the two sides played out a strangely subdued second half.
But in the five minutes of added time, a low cross by substitute Joe Willock deflected kindly for Guimaraes to snatch the winner with a diving header.
Guimaraes was Newcastle’s first big signing under their new owners, arriving from Lyon in the January transfer window for an initial £35m, and has helped provide the impetus to push the Magpies towards safety.
And despite arriving as a defensive midfielder, the 24-year-old now has three goals from five Premier League starts, and said his winner was the first headed goal of his career.
It made it five straight home wins for Newcastle and they now have 37 points – 12 clear of the relegation zone and three behind ninth-placed Leicester, whose five-game unbeaten run came to a dramatic end.
Foxes’ defensive frailties return
Leicester arrived on Tyneside buoyed by Thursday’s Europa Conference League win at PSV Eindhoven, which saw the club reach the semi-finals of a European competition for the first time. Manager Brendan Rodgers, though, made eight changes to freshen the team up.
The Foxes have struggled to defend set-pieces this season yet they opened the scoring with a training-ground routine of their own, Lookman’s eighth goal in all competitions this season capping a bright start.
Ayoze Perez superbly laid on James Maddison’s equaliser in Eindhoven and the Spaniard repeated the trick against his former club.
Kiernan Dewsbury-Hall drilled a corner low towards the near post, where Perez’s run put him in front of his marker and his deft flick with the outside of his right foot ran straight into the path of an unmarked Lookman. The forward’s low strike was too powerful for Newcastle goalkeeper Martin Dubravka to keep out.
But the visitors’ Achilles heel was exposed again just 11 minutes later, from the very first corner they conceded.
Newcastle centre-half Dan Burn leaned his 6ft 7in frame over Daniel Amartey to head down Jonjo Shelvey’s inswinging delivery, before Guimaraes poked the ball goalwards from right in front of Schmeichel and then bundled in while both players were on the turf.
At first glance it looked as though Guimaraes had knocked the ball from the Denmark keeper’s grasp. However, the video assistant referee, Lee Mason, recommended referee Jarred Gillett looked at his pitchside monitor and replays showed the ball had been stuck between Schmeichel’s legs, rather than his hands.
Leicester have now conceded 17 goals from set-pieces in the Premier League this season – more than any other team.
That leveller lifted the hosts and they finished the first half on top, before Leicester dominated possession after the break with Newcastle still the more threatening.
But they failed to create any clear-cut chances until Burn sent a free header wide from a late corner, while Leicester substitute Kelechi Iheanacho went close at the other end.
Willock then burst down the left wing and into the Leicester box, where Guimaraes was rewarded for his supporting run by sending the home crowd at St James’ Park into raptures.