LIAM Boyce netted a last-gasp penalty as Ross County edged to a crucial 2-1 victory over Dundee to give themselves a shot in the arm in their battle for survival in the Ladbrokes Premiership.
The Northern Ireland international striker slotted away a spot-kick at the death to see them leapfrog the Taysiders into eighth position.
Tim Chow shot the Dingwall team into an early lead but just before the break Dee's Darren O'Dea levelled from the spot.
County's Jim O'Brien was sent off for a second booking late on before Boyce buried the penalty which was won by Michael Gardyne.
The sides made three changes apiece following defeats of very different degrees in the past few days.
Following their 2-1 defeat at Partick Thistle, home manager Jim McIntyre pitched Chow, O'Brien and Gardyne to his starting 11.
Alex Schalk dropped to the bench alongside Christopher Routis and defender Jay McEveley.
A talking point before a ball was kicked for County fans was that with Schalk missing out, it would mean a 4-4-2 formation with main striker Boyce switching from the deeper role he has played often this season to partner Craig Curran in attack.
Dundee were reeling from their 7-0 hammering by rampant Aberdeen on Friday night.
The visitors brought in former Caley Thistle midfielder Danny Williams, Marcus Haber and Henrik Ojamaa put into the starting line-up.
County, whose fading top six hopes were shattered at Partick, began the night a mere three points above Inverness CT in bottom spot.
Dundee were only two points and one place better off.
The announcer at the Global Energy Stadium urged the home supporters, who incidentally were not out in great numbers, to get right behind their team.
And they were on their feet cheering a goal in the seventh minute.
O'Brien whipped a ball wide out to Boyce, who cut inside the box and he cut the ball back for Chow, who steered his shot past Scott Bain into the net.
What a start for the Staggies.
Dundee looked for a swift response and Paul McGowan's free-kick was knocked wide by Mark O'Hara.
Then O'Hara's superb effort drew a fine diving save from Fox as the visitors pressed.
Martin Woods and O'Brien was looking for openings and the latter lined up Curran on 20 minutes but the striker guided that effort wide.,
Woods had to be replaced on 26 minutes after taking a knock in a challenge. He was replaced by Frenchman Routis.
Boyce then won a free-kick when he was tripped by O'Dea after winning possesion from the Dundee captain and Andrew Davies swerved the 25-yard set-piece just past the left post.
There was a second injury blow for County in the first half as stand-in skipper Davies fell awkwardly and had to go off, being replaced by McEveley in the back line.
Moments later, Dundee were appealing for a spot-kick when McEveley challenged Ojamaa in the box, but referee John Beaton waved play on.
At the other end, County thought they had a corner when Curran shot, but strangely a goal kick was given to the visitors.
On the stroke of half-time, Dundee were handed a lifeline Fraser seemed to trip bring down Ojamaa in the box and a penalty were awarded.
Up stepped skipper O'Dea and he fired the ball high past Fox for the equaliser.
During the six minutes of stoppage time added on for the injuries, Boyce saw his header superbly touched on to the bar by Bain as he met a corner, but it bounced off the line before being cleared.
The first chance of note after the interval came when a quick throw-in from Naismith found O'Brien in the box and his looping ball was met by the head of Boyce, but Bain was equal to it.
Play raged from end to end for a while and Routis had a crack with a half volley which flashed over the top on 64 minutes for the hosts.
Not long after this, Naismith drilled high over the bar from 15 yards after Boyce played him in.
O'Brien's night ended with 10 minutes to go when he went down in the Dundee box under a challenge from Holt but Beaton flashed a second yellow card for a dive and he walked.
With the clock running towards 90 minutes, Gardyne was tripped in the box by Cammy Kerr and the spot-kick was given.
Boyce stepped up to the mark and made no mistake as he lashed the ball past Bain for a dramatic winner.
Following a late appeal for a Dundee spot-kick which was ignored by the referee tempers boiled over between both sets of players and Williams was sent off for a second booking.
So, County are off to second bottom Hamilton at the weekend as they seek the victory which would give them further breathing space before their final pre-split game against champions Celtic a week on Sunday.
County are now six points clear of Caley Thistle, who lost 1-0 tonight at second-placed Aberdeen.
Ross County: Fox, Davies (McEveley 34 replaced by Tumilty 79), Boyce, Naismith, Chow, Woods (Routis 26), van der Weg, Curran, O'Brien, Fraser, Gardyne. Subs not used: McCarey (GK), Schalk, Lalkovic, Dow.
Dundee: Bain, Holt, Vincent, O'Dea, Willliams, O'Hara, McGowan, Haber, Ojamaa (Wighton 61), Kerr, Gomis. Subs not used: Mitchell (GK), Hateley, Ross, Klok, Higgins.
Referee: John Beaton.