The Staggies' 2-0 defeat at Tynecastle left the visitors second from bottom in the Scottish Premiership table.
However goal-scoring hero Hamill, who netted the opener from the penalty spot, was later given his marching orders after collecting his second yellow card of the match.
The first half in Edinburgh had been a particularly dire affair, with the first shot on goal coming in the 27th minute.
And the closest either side came to scoring before the break was a shot by County's Michael Tidser who - from outside the box - fired wide of the right post.
The second half was a much brighter occasion with Jamie MacDonald saving well from County's Graham Carey on the hour mark before Hearts broke the deadlock from the spot.
With 64 minutes on the clock, Carey fouled Kevin McHattie and Hamill found the back of the net with a rising shot.
Yet shortly afterwards the midfielder was taking an early shower after being shown a second yellow card for his part in a touchline melee.
The visitors came mighty close to snatching an equaliser in the first minute of overtime when Jordan Slew headed inches over the bar.
But 10-man Hearts sealed the three points deep into injury time when Carrick converted Scott Robinson's assist from inside the box.