The home side were undone by a Gary Warren double which came either side of Billy McKay's 22nd strike of the season.
Yet Hearts had twice equalised through Jason Holt and a deflected Andy Webster strike - but both times handed the initiative back to their Highland visitors within minutes.
Visiting defender Warren came up with a meaningful contribution 16 minutes in. From a free-kick, Aaron Doran picked out Warren's march into the area and the Englishman headed past stationary Hearts stopper Jamie MacDonald.
The Jambos were back on level terms on 55 minutes. Arvydas Novikovas and Darren Barr exchanged passes before the later rolled the ball square for Jason Holt on the edge of the box. After evading Warren's challenge with a shoulder feint, he sent a well-hit shot with his right foot soaring past Ryan Esson in the away goal.
Parity lasted just seven minutes, though, as Inverness struck for a second time. David Raven launched a free-kick from halfway into the box which Owain Tudur Jones met with a firm header to pick out McKay lurking at the back post. The striker still had to beat Callum Tapping to the ball but found the required yard to nod home.
The hosts, though, responded again - but their second equaliser came with a heavy slice of luck.
First they won a disputed corner which Warren insisted should have been an Inverness goal-kick. It looked as though the visitors would escape unscathed, though, when Michael Ngoo met the set-piece with a tremendous header only to see Nick Ross clear from underneath his own bar.
Hearts, however, remained alert and worked the ball back to Webster on the edge of the box and he volleyed past Esson but only after the ball deflected off Daniel Devine.
But it was Caley who would strike for the third time. Hearts let Warren run free again and he headed past MacDonald from Graeme Shinnie's in-swinging corner to edge Inverness above Motherwell and into second place by a point.
- Sports & Recreation