Melvin De Leeuw came off the bench to hit the winner for Ross County in an entertaining match against St Mirren at Global Energy Stadium.
Yoann Arquin gave County a deserved lead in the 38th minute but John McGinn levelled midway through the second half.
With seven minutes left on the clock De Leeuw tucked away an Arquin cut-back to make it 2-1 and earn County all three points.
The result meant County climbed ahead of their visitors in the standings, nudging up a place to ninth.
St Mirren forced a corner in the first minute but it came to nothing. At the other end a Richard Brittain free-kick fell for Yann Songo'o but he could not get enough purchase on his shot and goalkeeper Marian Kello made an easy save.
It was end-to-end stuff early on and St Mirren's Kenny McLean slipped the ball through for Gregg Wylde but his angled drive was blocked by Mark Brown at his near post.
The next chance fell to County's Brian McLean who got on the end of another Brittain free-kick but his weak header was easily saved by Kello.
A long-range effort from Kenny McLean forced Brown into a fingertip save and Josh Magennis also tried his luck from distance but this time the shot was just over.
Songo'o passed up another good chance in the 20th minute when an Arquin cross left him with a chance at the far post but he headed wide.
A minute later Jordan Slew broke clear inside the St Mirren box but Kello pulled off a fantastic point-black save with the ball ending up on the top of the net.
There was no shortage of chances and when Filip Kiss whipped in a cross from the right Arquin was only inches away from making contact.
Graham Carey then had a couple of efforts that were not far away but the breakthrough came in the 38th minute when Michael Tidser clipped the ball in for Arquin who sent a looping header over Kello and into the net.
County had another chance seconds later when Slew drove at the visitors' defence and his square ball fell for Arquin but this time Kello pulled off a save before Jim Goodwin cleared the danger.
The home side were going for the jugular and after Carey sent a shot wide of target a clever flick from Arquin just cleared the far post.
Saints made a change at half-time with Paul McGowan coming on for Eric Djemba-Djemba.
County should have gone 2-0 up right at the start of the second half when Brittain cut in from the right and set up a chance for Slew whose shot was blocked by Kello, and when the ball fell for Arquin the goalkeeper made another point-blank save.
St Mirren got themselves back on level terms following a corner kick on the right. Wylde's flag kick was only partially cleared by Erik Cikos and McGinn nipped in and drove the ball into the far corner of the net from 15 yards.
A flashpoint in the 75th minute saw managers Derek Adams and Danny Lennon sent down the tunnel after Goodwin and De Leeuw clashed in the middle of the park.
The winner came eight minutes later when Arquin cut in from the left and his ball was swept high into the net by De Leeuw.