Greig Spence's late close-range finish defeated Falkirk and took Raith Rovers into the Ramsdens Cup semi-finals.
Former Celtic striker Spence converted Jason Thomson's low cross to beat the 2012 winners in the only all-Scottish Championship quarter-final tie.
Bairns forwards Rory Loy and Philip Roberts had earlier missed good chances to put the visitors ahead.
But substitute Spence's fifth goal of the season was enough to put them into the last four of the tournament.
The draw for that penultimate stage of the competition takes place on 19 September.
Reducing Hamilton's five-point lead at the top of the Championship is top priority for both of these top-half sides, but being one game away from a cup final will be a welcome distraction for the Stark's Park side.
Initially, it looked like the combined eight goals Roberts and Loy had provided Falkirk prior to the match would be added to.
Raith goalkeeper David McGurn spilled Loy's angled drive, but clutched it at the second attempt just as Roberts waited to pounce in the six-yard box.
Former Inverness forward Roberts likes to drift about in the final third for Falkirk and he surged past Lawrie Ellis on the left to deliver for Loy, who connected but sent his shot wide of the post.
The visitors' playing style was more technical, however Rovers refused to simply stand back and admire it and their direct approach began to cause problems.
Joe Cardle and Grant Anderson threatened for the hosts before Falkirk goalkeeper Graham Bowman did a textbook job of saving Lewis Vaughan's strike.
Roberts put an early second-half header from Craig Sibbald's cross past the post when it seemed easier to score.
Anderson fired narrowly wide from 18 yards for the hosts but the match-winning strike eventually arrived through Spence.
The 21-year-old came off the bench to stab home from six yards after a clever front-post run.
It takes Grant Murray's men one stage further in the competition than they managed last season.