Stephen Mallan headed home a late winner for 10-man St Mirren at Ross County to move the Paisley side off the foot of the Scottish Premiership table.
Sean Kelly gave Saints an early lead but they suffered a setback when Yoann Arquin, making his debut against his former club, was red-carded eight minutes before the break.
Substitute Liam Boyce looked to have rescued a point for County when he headed home with eight minutes to go but, against the odds, Mallan grabbed a vital second goal for the visitors.
County made a promising start to the match but it was Saints who had a great chance to take the lead in the fifth minute.
Kenny McLean got behind the home defence and his cutback found Jason Naismith in space, but the full-back's effort was deflected behind for the first corner of the match.
McLean burst through the County defence again in the 11th minute but his ball across the face of goal found no takers.
The visitors took the lead in the 16th minute when John McGinn breezed past Paul Quinn and, when his shot was parried by Antonio Reguero, Kelly followed up to slide the rebound home.
Buoyed by the goal, Saints went all out for a second and, after Kelly fired a low shot just past Reguero's left post, McLean just cleared the other upright with a snap-shot a couple of minutes later.
McLean was a constant threat to the County defence and he rattled the crossbar in the 30th minute after a good run and pass from Arquin.
McLean popped up again five minutes later when he got on the end of a Mallan pass, but he skied his effort well over.
Saints were well on top but in the 37th minute they were reduced to 10 men when Arquin was sent off after clashing with Lewis Toshney.
County made a change at the start of the second half with Boyce replacing Toshney as the home side went two up front.
The hosts opened up the Saints defence in the 54th minute when Boyce spread the ball out to Cairey and his ball inside found Craig Curran but, with only Mark Ridgers to beat, he fired straight at the keeper.
Another good build-up from County saw substitute Darren Maatsen try his luck from the edge of the 18-yard box but his fierce drive flashed narrowly over the crossbar.
Cairey went close with a free-kick which just cleared Ridgers' left post, and Woods then forced a save from Ridgers as County pushed for an equaliser.
The pressure paid off in the 82nd minute when Boyce nodded in from following a flick-on from substitute Jake Jervis.
County almost went ahead shortly afterwards but Jackson Irvine's header was somehow kept out from point-blank range.
And, with three minutes remaining, Saints hit the winner when Mallan headed in a Kelly cross.
Why are you making commenting on The Herald only available to subscribers?
It should have been a safe space for informed debate, somewhere for readers to discuss issues around the biggest stories of the day, but all too often the below the line comments on most websites have become bogged down by off-topic discussions and abuse.
heraldscotland.com is tackling this problem by allowing only subscribers to comment.
We are doing this to improve the experience for our loyal readers and we believe it will reduce the ability of trolls and troublemakers, who occasionally find their way onto our site, to abuse our journalists and readers. We also hope it will help the comments section fulfil its promise as a part of Scotland's conversation with itself.
We are lucky at The Herald. We are read by an informed, educated readership who can add their knowledge and insights to our stories.
That is invaluable.
We are making the subscriber-only change to support our valued readers, who tell us they don't want the site cluttered up with irrelevant comments, untruths and abuse.
In the past, the journalist’s job was to collect and distribute information to the audience. Technology means that readers can shape a discussion. We look forward to hearing from you on heraldscotland.com
Comments & Moderation
Readers’ comments: You are personally liable for the content of any comments you upload to this website, so please act responsibly. We do not pre-moderate or monitor readers’ comments appearing on our websites, but we do post-moderate in response to complaints we receive or otherwise when a potential problem comes to our attention. You can make a complaint by using the ‘report this post’ link . We may then apply our discretion under the user terms to amend or delete comments.
Post moderation is undertaken full-time 9am-6pm on weekdays, and on a part-time basis outwith those hours.
Read the rules hereComments are closed on this article