Come the end of the season, Ross County may well reflect on this trip to McDiarmid Park as a turning point.
The Staggies travelled to Perth in desperate need of a victory after a worrying 10-game run without a win that had left them rooted to the foot of the Scottish Premiership.
Jim McIntyre’s players have been struggling at both ends of the park, having netted the fewest goals in the top flight this season and with the second worst defensive record behind local rivals Caley Thistle.
St Johnstone had been beaten just once in 14 encounters with the Staggies at McDiarmid Park but headed goals from Jay McEveley and Christopher Routis gave the visitors a two-goal lead at the break before Craig Curran headed home a third that looked to have wrapped up victory.
However, it turned into a thrilling finale when a Danny Swanson penalty and a strike from Steven MacLean reduced the deficit before the excellent Liam Boyce made sure of the three points with his seventh goal of the season.
The result moves County up to eighth position in the Scottish Premiership and, with five of their next seven matches at Dingwall, McIntyre’s side will be keen to build on this impressive victory.
The Staggies made two changes from the team that drew 1-1 with Rangers before the international break with Kenny van der Weg and Michael Gardyne, who ran St Johnstone ragged, replacing Erik Cikos and Ryan Dow.
There was an early moment of concern for the County support when goalkeeper Scott Fox required treatment after Saints captain Steven Anderson fouled him as he attempted to start a quick counter-attack by kicking long to Curran.
That was followed by some controversy in the 15th minute when MacLean fell to ground far too easily when attempting to round Fox.
Referee John Beaton, who will be in charge of this weekend’s Betfred Cup final between Aberdeen and Celtic, correctly waved away the appeals for a penalty, with the St Johnstone attacker fortunate to avoid being booked for simulation.
Instead, it was County who took the lead after 24 minutes with their first attempt on target.
St Johnstone have looked particularly vulnerable at set-plays recently and the Staggies took full advantage of some static defending when an in-swinging Chris Burke corner was pounced upon by McEveley, who nodded beyond Zander Clark to break the deadlock. The St Johnstone goalkeeper was next to require treatment in this bruising encounter after colliding with team-mate Joe Shaughnessy and Curran.
It went from bad to worse for the hosts eight minutes before the break after some more shambolic defending.
A powerful Curran drive was parried by Saints goalkeeper Clark but the County attacker showed great awareness to lay the ball into the path of Burke, who crossed for Routis to head home.
Both teams made changes at the break with County goalkeeper Fox, still struggling from the early knock, replaced by Irishman Aaron McCarey, while the hosts introduced Chris Kane and Tom Scobbie for Liam Craig and Shaughnessy as they looked for a route back into the match.
The Perth Saints were forced to make their final change only five minutes into the second half when their goalkeeper Clark was unable to continue and was replaced by Alan Mannus.
But the Northern Ireland international was helpless to prevent Ross County going three ahead after 63 minutes after a terrific move that culminated in Boyce crossing for Curran to head past Mannus from six yards out.
St Johnstone, however, pulled one back immediately when Swanson calmly converted from the spot after McEveley was penalised for handling a Blair Alston shot.
It became even nervier for the Staggies support with 10 minutes to go when MacLean slammed home a tantalising cross from Brian Easton.
But Boyce put the result beyond doubt after 84 minutes when his header from a van der Weg cross deflected off Scobbie and rolled into the net.
Relief for Ross County, who can now start looking up the table.