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.
Grant Murray's Raith Rovers dumped out the 2012 winners Falkirk
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.
- 01 McGurn
- 02 Thomson
- 03 Booth
- 04 Watson
- 16 Ellis
- 06 Fox
- 07 Cardle
- 08 Moon
- 11 Anderson Booked
- 10 Elliot
- 21 Vaughan (Spence - 61' )
- 19 Roberts
- 14 Donaldson
- 12 Callachan
- 09 Spence
- 15 Smith
- 12 Bowman
- 02 Duffy
- 03 Kingsley
- 05 Flynn
- 06 Vaulks
- 07 Fulton (Grant - 77' )
- 09 Roberts Booked
- 10 Sibbald
- 11 McGrandles
- 13 Bingham (Shepherd - 89' )
- 33 Loy
- 22 Kyle Turnbull
- 16 Grant
- 19 Leahy
- 32 McNabb
- 31 Shepherd