With so much at stake, it was a day for experience and Paul Hartley saw his strikers all come good when it mattered with Christian Nade, Peter MacDonald and Craig Beattie getting goals.
Afterwards Hartley said he was proud of his players and will now look for them to produce another stirring 90 minutes against Dumbarton on Saturday at Dens Park to take them across the finish line.
"We've taken a lot of criticism this week after losing to Morton, but I thought we were fully focused and professional today," Hartley said.
"Alloa started better than we did, but the important thing was to get the three points and take it to the last game."
Graeme Holmes almost gave Alloa an early lead with a lob but Kyle Letheren scrambled the ball out for a corner. A Holmes cross struck the top of the crossbar as the match swung one way then the other.
Scott Bain denied Nade before half-time when he blocked a six-yard shot, but Nade beat the goalkeeper moments later to give Dundee the lead from a Kevin McBride cross.
Dundee doubled their lead when Darryl Meggat handled a Nade header - earning him a second yellow card and an early shower - and MacDonald drilled home the penalty.
Beattie made sure of the points with a third goal minutes after MacDonald hit the crossbar.
Falkirk faltered with a 1-1 draw at relegated Morton although it keeps their title hopes just flickering. Morton survived some early pressure and should have taken the lead when Dougie Imrie's corner picked out Thomas O'Ware, but O'Ware glanced his header wide.
Conor McGrandles put Falkirk in front before the break when he touched home a cross from Rory Loy from two yards out.
Rowan Vine equalised from close range after Barrie McKay's cross caught the Falkirk back four flat-footed.
Craig Sibbald struck the post for Falkirk but it was Morton who looked the more likely to win it in the closing few minutes.
Queen of the South effectively booked their place in the promotion play-offs with a 2-0 win over Livingston at Palmerston Park.
The home side almost took the lead after five minutes when Mark Durnan's netbound header was cleared off the line by Calum Fordyce. Queens took the lead midway through the first half when Ian McShane caught Livingston dallying in possession and raced through to produce a composed finish.
Iain Russell made it 2-0 with a precise finish after Paul Burns had laid the ball back.
Cowdenbeath could yet avoid the relegation play-off after they closed the gap on Alloa with a 2-1 win at Raith Rovers.
The Central Park side took the lead in the 19th minute when Kane Hemmings' pass found Rory McKeown and he advanced goalward before clipping the ball over Lee Robinson.
Lewis Milne fired past the goalkeeper in the 81st minute to make it 2-0 before Raith substitute Greig Spence pulled a goal back.