Sloan struck midway through the second half of an awful game in which neither side got going.
A poor first half saw little in the way of chances, but when they did arrive Paul McLeod missed a sitter from six yards for Alloa.
Ayr's response was a neat turn and shot from Jerome Vareille which was tipped wide by Allan Creer.
Things didn't improve after the break, and Gareth Wardlaw's powerful drive which was saved was all Ayr had to offer before Alloa struck.
John Grant crossed for Sloan to fire home from close range and all but sink Ayr's promotion hopes.
United poured forward in search of an equaliser, but rarely looked like snatching a point.
Delighted Alloa boss Allan Maitland said, "I felt we were ready to win our first game and anyone who has seen us over the last four weeks knows the attitude and commitment of the boys has been great."
Ayr boss Robert Connor groaned: "That's probably the worst we have played since I came here and it happened in a game we really needed to win."