Hearts clocked up their first league win since November and moved onto positive points thanks to a late winner from Scott Robinson.
Callum Paterson gave Hearts a deserved lead in the 37th minute with a tap in following a David Smith corner but Yann Songo'o levelled on the stroke of half time when he headed home a Richard Brittain free-kick.
The match looked to be heading for a draw but with 10 minutes to go Robinson pounced on a Michael Fraser punch out to drill the ball into the net for a dramatic winner.
Loading article content
Hearts had a chance to take the lead after only 20 seconds when Songo'o lost possession of the ball and David Smith's cross to the far post was scooped wide by Sam Nicholson.
The visitors had another chance seconds later when Smith sent over an inviting delivery to the near post but Paterson knocked the ball past the wrong side of the post.
County's first effort of note arrived in the sixth minute when Graham Carey got behind the Hearts' defence but his whipped in cross was just missed by Brittain at the far post.
But most of the action was at the other end and Smith caused havoc again with another dangerous cross which Dale Carrick just failed to get enough purchase on.
Then Smith had a go himself with a low drive but his effort flashed past Michael Fraser's right hand post.
The visitors continued to set the pace and they came close again in the 24th minute when Smith played in Carrick but his shot flew into the side netting.
County were only seen in snatches but they were not far away five minutes later when a Carey free-kick was knocked back across goal by Yoann Arquin and Jordan Slew headed narrowly past the upright.
It looked just a matter of time before Hearts took the lead and the opener came in the 37th minute when Smith's corner from the left was touched on by Danny Wilson and the ball fell kindly for Paterson who tapped in with his left foot from a yard out..
But County hit back and against the run of play they grabbed a leveller in the dying seconds of the half when a Brittain free kick was headed home by Songo'o.
County started the second half on the front foot and Songo'o was up looking to get on the scoresheet again when he knocked one over the top following a corner.
Hearts missed a really good chance to restore their lead in the 73rd minute when Paterson won the ball and set Smith off down the right and his cross into the box was headed over by Carrick from six yards.
It was Carrick's last involvement in the action as he was immediately replaced by Billy King.
But Hearts did restore their lead 10 minutes from the end when Smith's ball into the box was only cleared as far as Robinson who fired home through a ruck of players.
Hearts could have been out of sight in the 86th minute when full back Kevin McHattie charged through the County defence only to be denied by a point-black save from Fraser.
County threw on Melvin De Leeuw and Alex Cooper in a desperate attempt to save the match but Hearts held out for all three points.