Marcus Godinho and Callumn Morrison both scored their first Hearts goals to earn three vital points against in-from St Johnstone.
The Canadian struck first before his teenage colleague added a second in the final minute to secure victory. Hearts hit the post twice before opening the scoring and were the team in control throughout the afternoon.
Remarkably, St Johnstone had won their six previous away matches without conceding a single goal. That emphasised their dominant recent form, which included ten victories in their last 14 games in all competitions. They weren't in Edinburgh with any intention of blemishing that record.
However, the encountered a Hearts team much-improved following Wednesday night's home defeat by Dundee. They reinstated striker Steven Naismith following suspension and defender John Souttar made his first start since hip surgery. He lined up on the right of a back three at kick-off, with Godinho and Jake Mulraney in as wing-backs and Oliver Bozanic returning to central midfield.
Flags were out at as Tynecastle Park celebrated Foundation of Hearts Day and fans were treated to a confident display from their team.
The hosts created the first chance of the afternoon when their wing-backs combined. Mulraney delivered a useful cross from the left towards the six-yard line and Marcus Godinho's head met it at the back post. The Saints goalkeeper Zander Clark reacted instinctively with a vital save high to his left.
Mulraney put in several crosses in what was developing into a decent encounter with both teams keen to pass the ball. The Irishman then came tantalisingly close to opening the scoring. He sprinted on to Arnaud Djoum's through ball in behind the St Johnstone defence, but his shot was deflected onto the post and out for a corner by Clark.
Bozanic's free-kick near the interval hit the visiting wing-back Richard Foster prompting penalty appeals from Hearts which referee Craig Thomson ignored. The home side enjoyed plenty possession inside the opposition half and were certainly the stronger team at the break. Goalkeeper Colin Doyle had barely touched the ball.
Hearts struck the goalframe at the other end early in the second half. Sean Clare collected a loose ball and angled a left-footed attempt across St Johnstone goal, only to see it rebound off the far post before being cleared.
The notion that a goal was imminent was justified when Godinho delivered on 52 minutes. He ventured forward to display sublime close control by bringing down Souttar's lofted pass inside the penalty area. As Clark steadied himself, the wing-back fired a powerful shot which the keeper couldn't prevent bouncing into his net. Godinho set off to celebrate looking ecstatic at his first goal in maroon.
St Johnstone had barely threatened but now faced the task of trying to fashion an equaliser. They introduced substitutes Michael O'Halloran, Danny Swanson and Callum Hendry. Hearts, though, had designs on increasing their lead and Clark had to parry Clare's attempt from an acute angle on 84 minutes.
David Vanecek replaced Clare for the final few minutes and received a warm reception from the home support. Clark sprung to his right on 89 minutes to repel Olly Lee's curling free-kick but the points were secured seconds later.
Hearts broke forward in a move involving Naismith, Demetri Mitchell and Lee. It ended with Lee's measured pass being rammed viciously into the net by the onrushing substitute Morrison. Like Godinho, he also celebrated extensively after his first senior strike for the Edinburgh club.
Hearts (3-4-2-1): Doyle; Souttar, M Smith, Berra; Godinho (Mitchell 80), Djoum, Bozanic, Mulraney (Morrison 82); Lee, Clare (Vanecek 87); Naismith. Unused subs: Zlamal, Shaughnessy, MacLean, Cochrane.
St Johnstone (3-4-1-2): Clark; Kerr, Gordon (O'Halloran 59), Shaughnessy; Foster, Davidson, Craig, Tanser; Callachan (Swanson 58); Kennedy, Watt (Hendry 69). Unused subs: Hurst, Alston, Anderson, Wotherspoon.
Referee: Craig Thomson.