Hearts moved up to third in the Scottish Premiership after picking up their first away win against St Johnstone in 12 years.
Substitute captain Lawrence Shankland netted a well-taken penalty after Ryan McGowan played handball, before Alan Forrest completed a fantastic passing move to double the visitors’ lead.
St Johnstone missed a penalty then scored one through Stevie May, but Barrie McKay restored Hearts’ two-goal lead before Jamie Murphy’s late consolation effort.
Robbie Neilson’s side are three points ahead of Aberdeen, while St Johnstone drop to sixth place.
Hearts still counted the cost of their visit to Tannadice on Christmas Eve, but they didn’t seem overly embarrassed by the loss of Craig Gordon, Craig Halkett or Stephen Kingsley.
Instead, they flew out of the traps on a miserable night in Perth, with Jorge Grant hitting a post as it looked easier to score.
He quickly made amends by taking a shot at McGowan’s arm. Penalty given and duly forwarded by Shankland.
It was almost two o’clock when Andy Halliday’s shot went over the bar.
The hearts had come to play. Under the guidance of Robert Snodgrass, they played numerous passes all over the pitch before Halliday slid Forrest into the box and he curled into the bottom corner.
St Johnstone was given a lifeline when a penalty came out of nowhere. It was a smart spot from VAR Grant Irvine after a limited call from the home side, but Cammy Devlin had managed. Carey lined it up and threw it over the bar.
The hosts had been lifted, however, and Zander Clark was expected to look sharp on his return to Perth, denying a lively May before tipping a deflected effort from Ali Crawford onto a post.
The second half started at the same pace as the first, and St Johnstone had another chance to cut the deficit when Snodgrass carried May to the ground. The striker pinned him down the middle, getting the better of his former teammate Clark.
Within 10 minutes, Hearts had restored the advantage. Barrie McKay, fresh off the bench, jumped by McGowan and whipped him into the bottom corner from 25 yards out.
The game was not over. Shankland had the pocket picked up in his own half and the sub Murphy fired into the bottom corner before it was closed.
It would only be a consolation in the end as Hearts picked up their first league victory in Perth since 2010.
Player of the Match – Robert Snodgrass (Hearts)
Flowing hearts end Perthshire hoodoo – analysis
As vital as that victory was for Hearts, Robbie Neilson’s mood would have been further elevated by the results around them. Three points ahead in third by Hogmanay, it’s half a campaign as successful as he could have hoped.
They started with an urgency and power not seen since the first half of the Zurich play-off at Tynecastle. Forrest added a threat at the back, with Josh Ginnelly proving to be a real nuisance.
However, they looked a little shaky at the back with the loss of two first-choice defenders in Halkett and Kingsley.
St Johnstone didn’t play badly at all, but they were penalized for defensive fouls. However, they seem much stronger than last season.
what they said
St Johnstone manager Callum Davidson: “The reason we got beaten was that we didn’t start for 25 minutes against a good quality team. It was disconcerting because the players had the same instructions.
“There’s a big difference between us now and this time last year. There’s a confidence that runs through the players and we have to make sure that that application and that attitude stays.”
Robbie Neilson, Head of Cores: “I enjoyed the first half. I think we played well, we controlled the game, played through the lines, got into good areas and did exactly what we wanted to do.
“In the second half St Johnstone had more control and made the game more erratic. We couldn’t take control of the midfield area and let them get back there. It was an entertaining game. “
St Johnstone host Dundee United on January 2, while Hearts host Edinburgh rivals Hibs on the same day (both at 15:00 GMT).