SPL - Motherwell win to keep second spot
The deflected 25-yard free-kick with four minutes to go came immediately after Caley Thistle defender Chris Hogg was shown a straight red card.
Inverness dominated for much of the game and broke the deadlock after three minutes when David Davis curled home before Shaun Hutchinson levelled six minutes before the break.
Andrew Shinnie put Inverness back in front after 76 minutes but Keith Lasley lashed home an equaliser 60 seconds later.
Hateley then got the late winner to give Motherwell a three-point cushion over Celtic, who were held 0-0 by Hibernian, in second place and kept Caley Thistle at the foot of the table.
Rangers remained nine points clear at the top after a 2-1 win at Aberdeen in the early kick-off.
Sergio is set to appear before the Scottish Football Association's disciplinary committee on Thursday but could now be summoned again for remonstrating with referee Alan Muir and being dismissed after 77 minutes of a frustrating afternoon for Hearts.
Ian Black was sent off after 16 minutes for the hosts, leaving his team-mates, whose wages are 12 days overdue, facing the remaining 74 minutes with a man short.
Hearts dominated despite their numerical disadvantage, but suffered defeat as a result of Dean Shiels' 55th-minute controversial penalty.
Dundee United eased the pressure on under-fire manager Peter Houston with a 4-1 hammering of Dunfermline at East End Park.
First-half goals from Paul Dixon and Lauri Dalla Valle gave United a comfortable advantage but Andy Kirk netted early in the second half to pull the home side back into it.
However, late goals from Johnny Russell and Mackay-Steven secured victory for the visitors.
Kenny McLean netted his first goal for St Mirren as they scraped a narrow 1-0 victory over St Johnstone.
McLean grabbed the only goal of the game late on to provide one of the few highlights in what was a largely dull affair at McDiarmid Park.
The win allowed the Paisley club to bounce back from their midweek Scottish Communities League Cup exit to Irn-Bru First Division side Ayr United.