Inverness ended their six-game winless run and moved out of the Scottish Championship relegation zone with a 2-0 victory at Ayr.
The hosts slide into the bottom two after suffering back-to-back defeats.
Ayr thought they had taken the lead after 24 minutes when Michael Miller headed in from Tom Walsh's cross but they were denied by the offside flag.
And it was Caley Thistle who drew first blood seven minutes later as Daniel MacKay rounded off a swift counter-attack having been played through by Shane Sutherland.
Luke McCowan threatened to equalise twice just before half-time but his 18-yard strike and then a close-range header were kept out well by Mark Ridgers.
Sutherland struck nine minutes after half-time to double the visitors' lead, turning smartly inside the area before firing past Viljami Sinisalo.
Ridgers denied Walsh 12 minutes from time with a fine save as Inverness saw the game out.