Inverness moved level on points with third-placed opponents Ayr as Cameron Harper’s goal snatched a 1-0 win.
Ayr enjoyed the better of the first half, with Andy Murdoch firing narrowly wide in the early stages and Mark McKenzie seeing a headed effort come back off the crossbar.
Josh Mullin had a shot saved in the 23rd minute and McKenzie was not too far away with another strike before the break.
The home side were made to pay for their profligacy at the start of the second half as Cameron Harper headed Inverness in front.
Ayr substitute Jayden Mitchell-Lawson curled inches wide shortly after coming on but that was the closest they came as Inverness held on.