Fernando Llorente netted his 14th goal of the campaign before Kyle Naughton hammered home a second in first half stoppage time to take Paul Clement's side four points clear of the bottom three.
But regardless of the outcome, a win for the south Wales club against West Bromwich Albion on the final day next weekend (21 May) will keep them in the top flight for a seventh straight season.
"It's a huge result for us," said manager Clement, who took over from Bob Bradley in January. "We've got ourselves into a strong position but the season is not over and we don't think it is done. Now have to look to next week.
"There's still one game to go. We'll be looking at the Crystal Palace and Hull game with a lot of interest but we can be happy with our work today. It was a bit of a messy second half but we got the job done."
The home side took the lead in controversial circumstances as David Silva slotted past Kasper Schmeichel, but not before Raheem Sterling attempted to turn the ball in while standing in an offside position.
After much consultation, referee Bobby Madley awarded the goal and City were soon two to the good after Gabriel Jesus' sixth Premier League goal in five starts came from the penalty spot after Yohan Benalouane hacked down Leroy Sane.
The Foxes were not at the races but they halved the deficit shortly before the break when Shinji Okazaki volleyed into the roof of the net, an incident which preceded the game's major talking point.
Gael Clichy conceded the game's second penalty when he brought down Riyad Mahrez, but despite finding the net from the spot last season's PFA footballer of the year's effort was chalked off as he slipped in the process of taking the kick, connecting with the ball twice; leading to an indirect free-kick.
City held on for the three points and are now within touching distance of cementing a top four spot.
Leicester meanwhile, who lost their crown as English champions after Chelsea beat West Brom to win their fifth title in 13 seasons, remain in the shake up for a top half place. But much of the post-match discussion centred around the second half flashpoint.
"I didn't see it at the time. It's a freak thing you don't see often," Leicester boss Craig Shakespeare said. "To the letter of the law it's a double touch, but he could bring it back for an encroachment from Manchester City so there's a bit of injustice. Its bad luck from our point of view."
Elsewhere, AFC Bournemouth climbed into the top half for the first time since January after striking late to beat Burnley. The Clarets had looked set for a point after Sam Vokes' header cancelled out Junior Stanislas' opener, but Josh King scored his 13th goal in 16 games to claim all three points for the Cherries.
Former Manchester United and Blackburn Rovers forward King, who took his tally for the season to 16, said: "The aim at the start of the season was to finish higher than last season and we are on the way to doing that. I set myself a target of 15 goals at the start of the season. I believe in myself but you can't do anything without your team-mates.
"I have been building on my confidence. Once you start scoring it builds. This is my first season where I have scored like this. Next year I need to prove myself and do it again before you can talk about me with Harry Kane and Romelu Lukaku. I can't wait for next season to start. I've enjoyed it here from day one. Being noticed by other clubs is positive but my focus is 100% here."
There was further success for the south coast as Southampton held on to beat Middlesbrough whose first game since being relegated to the Championship ended in a 20th loss of the season. Jay Rodriguez and substitute Nathan Redmond put Saints in cruise control, but Shane Long's missed penalty gave Boro a lifeline. Patrick Bamford netted for the first time for two years to cut the lead but the hosts were unable to complete the comeback at the Riverside.