Brian Gilmour scored the winner as Ayr United came from behind to beat Hibernian 2-1 at Easter Road in the Scottish Championship.