Nathan Austin scored the only goal as Inverness finished their Scottish Championship season in third place thanks to a 1-0 win over Dunfermline.
Caley Thistle climbed above Ayr in the standings and will now face them in a play-off for promotion to the Ladbrokes Premiership, with the first leg next Tuesday.
Austin broke the deadlock in the 35th minute after a mix up in the Dunfermline defence.
Cammy Gill failed to deal with a back pass from Stuart Morrison and Austin nipped in to put the ball past the Pars keeper.
Tom Walsh almost claimed the hosts’ second goal in the 85th minute after Gill made a great save and pushed his effort on to the post.