Wanyama's goal was crucial, but it took a late and dramatic Fraser Forster penalty save to secure the home win.
Anthony Stokes' second-half header which hit the bar was the closest Celtic had come to breaking the deadlock before the Kenyan drove high past Marian Kello in the 72nd minute to apparently ease the pressure on Neil Lennon's men, who had been hitherto unconvincing.
Two minutes from time, though, Wanyama conceded a penalty when he was adjudged by referee Calum Murray to have handled in the box as Celtic defended with some desperation but Forster dived to his left to save Eggert Jonsson's spot-kick.
Celtic head into Thursday night's do-or-die Europa League game against Udinese in Italy - where victory is required to get through to the knock-out stages - buoyed by the win which keeps their title hopes alive and kicking.
For Hearts, one wonders how their season is going to develop after yet another blow.
PFA Scotland, the players' union, this week urged the Scottish Premier League and Scottish Football Association to intervene over the continual non-payment of salaries.
That was mostly forgotten by the end of a game which took so long to come to life.
Lennon made one enforced change to his side after defender Adam Matthews was ruled out with an ankle injury.
Charlie Mulgrew came in at left-back while Hearts showed three changes with Ian Black, Scott Robinson and Ryan Stevenson for Andy Webster, John Sutton and Rudi Skacel, the latter starting on the bench.
On a freezing cold day the supporters were looking for some entertaining football to warm them up but the first half was simply dire.
An early through ball by Georgios Samaras in the eighth minute, which was just too strong for wide-man James Forrest, was the first sign of anything resembling a threat to the Tynecastle men.
Mulgrew then had mixed success with corners from both sides, albeit they all came to nothing.
The Hoops momentum appeared at times to build, mostly down the right through Forrest and right-back Cha Du-ri, before quickly subsiding, to the frustration of the home fans.
Parkhead striker Gary Hooper missed Celtic's first real chance on the half-hour mark when he drove past the far post from close range after taking a Forrest pass, following good work by Cha.
Moments later, at the other end, Robinson drove high over the bar with a shot from distance but this remained a turgid encounter.
In the 34th minute Samaras, working from wide on the left, burst into the box before setting up Hooper but Celtic's top scorer got an unfortunate break of the ball which escaped into the arms of Hearts keeper Kello.
Three minutes from the break Stokes had a decent strike from distance but Kello parried and skipper Marius Zaliukas headed the ball back into his arms.
Scott Brown replaced stopper Glenn Loovens for the start of the second half, taking the armband from stand-in skipper Beram Kayal, as Wanyama moved back from midfield into defence.
But there was little immediate change and in the 55th minute as Hearts became slightly more confident, Robinson had another effort from distance, this time a powerful drive which went just wide of Forster's right-hand post.
At the other end, Brown set up Kayal whose right-footed shot on the slide from the edge of the box was saved by Kello but it looked as if the nerves among the Celtic defence returned whenever Hearts came forward.
Going forward, however, things looked a little more positive for the home side.
On the hour mark Forrest raced down the right and stood the ball up for Stokes whose header from 10 yards crashed off the top of the bar before going behind.
South Korea midfielder Ki Sung-yueng replaced Kayal as Lennon tried something different and he was rewarded soon afterwards although it was Wanyama who gave the home side the lead.
As Celtic pinned Hearts back into their own box, the ball broke to the Kenyan who fired the ball from 25 yards high past Kello.
The dam had burst and minutes later Hearts substituted Black, Robinson and David Templeton for David Obua, Andrew Driver and Stephen Elliott.
Celtic were moving forward with some purpose now but six minutes from time Jambos' midfielder Mehdi Taouil had a strike saved by Forster at his right-hand post.
Two minutes from time there was potentially title-changing drama when Hearts were handed a lifeline, with Forster emerging the hero.