Ayr claimed a huge win on the road against Cove Rangers to put themselves just one point behind league leaders Queen's Park.