Alloa had the edge on Harris Academy in the quarter final of the BT Caledonia Regional Bowl (Midlands) at Elliot Road as knockout competition took centre stage on Saturday.
The home side had emerged as winners when the sides met on league duty earlier this month but Alloa took the honours in the final play of the game.
Harris led 7-3 at the interval after Mike Devlin touched down and Stewart Walker added the conversion, while Stevie Skelton slotted a penalty for the visitors.
Devlin claimed his second try of the afternoon and Walker again converted before booting a penalty, while Alloa responded with a touchdown from Matthew Duncan.
That left Harris 17-8 ahead with 10 minutes to play. The hosts received another boost when Alloa’s Michael Doig was shown a yellow card after straying offside.
However, even a man short, the visitors ensured an engrossing climax when Gregor Sneddon claimed a try.
And Alloa snatched the victory when Duncan darted over in the last action of the game for a try. Alan Keir’s conversion completed the scoring.
Carnoustie also booked a last four berth with a 39-27 win away to Grangemouth Stags.
Stags had inflicted Carnoustie’s only defeat of the season when the sides met on league duty earlier in the month, squeezing home 18-15.
And after 80 minutes of Saturday’s encounter they were locked together, sending the game into injury time.
During that added period, Carnoustie found the extra gear to eventually move into the last four.
Kenny Watt touched down twice for Carnoustie and there was one try apiece for Michael Downie, Anthony Franco, Euan Fraser and Ian Reid, while Danny Van Wyk and Niall Swanson shared the kicking duties to contribute the other points.
Also taking a place in the semi-final draw will be Stirling University, who posted a 23-16 win over Crieff & Strathearn and Panmure, after the Broughty Ferry men were awarded the tie against Madras Rugby.
Dundee University trimmed the gap on pacesetters Arbroath in Division Three (Midlands East) when they recorded a 45-8 success away to Glenrothes seconds.