Ross County 2-1 Hearts
Ross County scored twice in the closing two minutes to come from behind and sink Hearts in Dingwall.
Melvin De Leeuw headed home from a Richard Brittain cross to level and the roles were reversed for the winner.
The visitors opened the scoring when Callum Paterson turned the ball home smartly on 24 minutes.
Paterson went close again but the Staggies created the better chances and were rewarded for their efforts with a dramatic comeback.
Hearts must have thought they were on course to take a further bite out of the gap that separates them from struggling St Mirren at the foot of the Scottish Premiership.
But the Edinburgh side could not profit from the Paisley side's loss at Hibs and remain nine points adrift, having started the season with a 15-point penalty for going into administration.
The last-gaps goals earned a second win of the season for Derek Adams' men and moves them to within a point of seventh-placed Dundee United.
County started well and Ivan Sproule was almost through on goal in the fourth minute only to have his progress halted by a great Kevin McHattie tackle.
Scott Boyd was off target with a header either side of shots from Brittain and Steven Ross.
But it was the visitors who took the lead when McHattie whipped a ball into the box and Paterson tucked the ball past Brown from six yards.
The home side responded with more pressure and the first half ended with Ross shooting wide after a goalmouth scramble.
Ross had the goal in his sights again on 55 minutes but his effort flew high and wide.
Despite being on the back foot, Hearts created a really good chance just after the hour mark.
Jason Holt got to the byline and his cut-back was slightly behind Paterson who could only deflect the ball wide of Mark Brown's left-hand post.
Brown then had to turn away a strong shot from Holt.
The game was level when Brittain swung over a deep cross from the right touchline and substitute De Leeuw headed in at the back post.
It got better for County as the game entered stoppage time as De Leeuw fired over a cross from the left and Brittain headed powerfully into the net for the winner.