Billy Mckay broke his arm as he completed a hat-trick to keep relentless Ross County five points clear at the Championship summit with a game in hand.
It proved an incredible end-to-end battle with Ayr United, who fell eight points behind the leaders. The Honest Men levelled twice but slipped to a costly defeat as their 2019 nose-dive continued.
Mckay’s treble took him to the 20-mark for the campaign and left County unbeaten in eight matches, including six victories and two draws.
Inside the first minute, the hosts forced a corner and a fantastic save from Ayr goalkeeper Ross Doohan.
Josh Mullin’s delivery found young Tom Grivosti steering a header inside the right hand post, only for the on-loan Celtic keeper to tip it just wide.
Early County pressure gave way to a good spell for Ayr and Michael Moffat’s ball over the top found Lawrence Shankland who shot just wide.
The Staggies were dealt a blow after 22 minutes as Ross Stewart, with four goals in his last four games, hobbled off injured to be replaced by Brian Graham. A fine Michael Gardyne pass after 26 minutes slipped Mullin clean away in the box but Doohan again rose to the occasion with a strong block from 12 yards.
Home momentum was building and the breakthrough came on 35 minutes.
Jamie Lindsay’s looping high ball into the box was expertly controlled by Mckay and tucked past Doohan with ease from six yards.
It could have been two for County on half-time as Mullin clipped the top of the bar from 12 yards from Gardyne’s cut-back.
Ayr got back on level terms after 62 minutes as Liam Smith took a Shankland pass to race past Lindsay in the box. The cut-back found Shankland with time to slam in his 31st goal of the season.
But County went ahead again on 70 minutes as Mckay took a Lindsay pass on the edge of the penalty area and thrashed a tremendous finish high past Doohan.
Ayr hit back inside four minutes. A Shankland cross from the left was scooped up by a sliding Moffat for Andrew Murdoch to head home.
Remarkably, though, the Ayr equaliser was wiped out when Keith Watson’s header from a County free-kick was saved by Doohan. Mckay, for his hat-trick, slid in to score but broke his wrist as he landed awkwardly and exited immediately in agony.