Match ends, Ross County 2, Hamilton Academical 1.
Liam Boyce's goal gave Ross County victory over Hamilton Academical and sealed the Dingwall side's Scottish Premiership safety.
Lucas Tagliapietra headed in Ali Crawford's corner to give Hamilton a first-half lead.
County recovered in the second period with Michael Gardyne equalising.
And, despite losing Filip Kiss to a red card, the hosts moved ahead when Boyce struck and that ensured they will not face a relegation play-off.
The victory, coupled with Motherwell's defeat by St Mirren, means County will finish above second bottom.
At one stage in this campaign Jim McIntyre's side seemed favourites for relegation but a sequence of positive results, including a nine-game unbeaten run has ensured top-flight status.
The afternoon started brightly for County in terrible early conditions. Raffaele De Vita's low cross was met powerfully by Craig Curran only for McGovern to palm away.
As the weather improved, County started to offer more offensively with Gardyne wriggling away from defenders before firing narrowly wide.
But Hamilton went ahead when Lucas rose to meet Crawford's delivery and powered a header past Antonio Reguero.
The momentum was clearly with the visitors but Jamie Reckord's delivery almost provided an equaliser, Curran somehow missing the target when he slid in at the back post.
Gardyne then went down in the box after a Kieran MacDonald challenge, but referee Bobby Madden waved his claims away.
Half-time seemed to give Ross County time to regroup and they started the second period on the front foot.
Tony Dingwall replaced Curran and his energy helped McIntyre's side trouble Hamilton more directly.
Martin Woods fired in a deflected effort which McGovern tipped over the bar. From the resulting corner the ball found its way to Gardyne, who smashed a sweet left-foot effort past McGovern.
Scores from Motherwell's game and fellow strugglers Kilmarnock's march towards victory over Partick Thistle were filtering through to Victoria Park and tension increased with each passing minute.
Eamonn Brophy shot narrowly over and Darian Mackinnon had a header easily gathered as the visitors tried to regain supremacy.
And the ensuing drama that unfolded was extraordinary. Filip Kiss, playing at right-back, was inexplicably sent off leaving County a man down as they chased a vital winner.
McIntyre could clearly be heard asking "what happened?" as Kiss left the field.
As home supporters looked on through cracked fingers, County scored what proved to be the goal that secured their Premiership status.
A corner broke into the path of Boyce and the Northern Irishman seized on his opportunity to drill home.
The stadium erupted and all ears turned to what was happening elsewhere. Premature celebrations began with many inside the stadium believing Motherwell had drawn with St Mirren.
Crawford fired against the bar for Hamilton in the last bit of drama before the final whistle.
And when news arrived that Motherwell had lost, there was unrestrained joy for the home crowd as they danced on the pitch, delighted that their side had finally seen off the threat of relegation.
- 10KissBooked at 82mins
- 12ReckordBooked at 16mins
- 40GardyneSubstituted forBrittainat 86'minutes
- 24De VitaBooked at 80minsSubstituted forQuinnat 84'minutes
- 11CurranSubstituted forDingwallat 50'minutes
- 44De Lima TagliapietraBooked at 78mins
- 17LongridgeSubstituted forDochertyat 87'minutes
- 18MacKinnonBooked at 55minsSubstituted forHasselbainkat 89'minutes
- 20BrophySubstituted forScotlandat 83'minutes
- Bobby Madden
- Shots on Target
Second Half ends, Ross County 2, Hamilton Academical 1.
Foul by Liam Boyce (Ross County).
Grant Gillespie (Hamilton Academical) wins a free kick in the defensive half.
Corner, Hamilton Academical. Conceded by Jackson Irvine.
Substitution, Hamilton Academical. Nigel Hasselbaink replaces Darian MacKinnon.
Tony Dingwall (Ross County) wins a free kick in the defensive half.
Foul by Jesus Garcia Tena (Hamilton Academical).
Substitution, Hamilton Academical. Greg Docherty replaces Louis Longridge.
Substitution, Ross County. Richard Brittain replaces Michael Gardyne.
Goal! Ross County 2, Hamilton Academical 1. Liam Boyce (Ross County) right footed shot from the centre of the box to the bottom right corner.
Corner, Ross County. Conceded by Darian MacKinnon.
Substitution, Ross County. Rocco Quinn replaces Raffaele De Vita.
Michael Gardyne (Ross County) wins a free kick in the defensive half.
Foul by Kieran MacDonald (Hamilton Academical).
Substitution, Hamilton Academical. Jason Scotland replaces Eamonn Brophy.
Filip Kiss (Ross County) is shown the red card for fighting.
Raffaele De Vita (Ross County) is shown the yellow card.
Corner, Ross County. Conceded by Jesus Garcia Tena.
Corner, Ross County. Conceded by Louis Longridge.