Ayr overcame Inverness 1-0 at Somerset Park as third beat second in the Scottish Championship.
Stephen Kelly scored the only goal of the game just after the hour mark, netting for the sixth time this season in all competitions.
It was a third straight victory for Ayr – who found the target with just three of their 18 attempts on goal – and saw them move to within a point of their opponents in the table.
However, both teams remain some way behind runaway leaders Dundee United.
Inverness have now lost three of their last five league matches.