Former Ayr winger Declan McDaid's 20-yard strike and a Paul McGowan finish on the rebound condemned the hosts to a third straight loss.
Luke McCowan's first-half header cut the deficit, but Ayr United remain behind leaders Dundee United on goal difference ahead of Saturday's games.
Dundee move up a place to fourth.
Declan McDaid and Paul McGowan got the goals against Ayr United last Friday night as Dundee closed the gap on the teams at the top of the league. The Dark Blues have managed to narrow the gap on Ayr United and Inverness, while remaining 6 points behind league leaders Dundee United.
James McPake is expecting another hard game against Alloa after his Dundee side managed to earn a 2-1 win against Alloa in September.
The manager said “Another tough one, they were very good when they came here and they caused us real problems”.
“We won that game with a penalty save from Jack (Hamilton) to get the three points”.
“Peter Grant has them playing well with some really nice football, but it’s about our performance and what we can do to impose our game on them. If we can deal with the pressure then I am confident that we can come out on top”.
The only injury worries for the gaffer are Jack Hamilton and Josh Todd.
Hamilton will be side-lined as he recovers from an appendicitis surgery which will rule the ‘keeper out of the side for at least another month.
James McPake said: “We don’t know, it is a difficult one because he is a goalkeeper. It would have been easier if he was an outfield player but we are looking at around a month. Hopefully it will not be so long, as he has been good all season. He is recovering at home with his feet up after the key-hole surgery”.
Jamie Ness is back in contention for a place, with the midfielder being declared fit after suffering from "niggling problems” that the ex-Plymouth player picked up after being injured against Elgin City in September.
Josh Todd had to have a couple of stitches after the Ayr United game, and the manager stated he will assess the player’s fitness prior to the game before making a decision whether or not he will be available to make the squad.