League One Yeovil Town booked an FA Cup meeting with Manchester United after beating Accrington in their second-round replay.
The Glovers, who are 21st in the third tier, left it late to secure victory against their League Two opponents.
Simon Gillett broke the deadlock on 84 minutes and substitute Kieffer Moore doubled the lead four minutes later.
Yeovil will now host the 11-time FA Cup winners at Huish Park in a televised match on Sunday, 4 January.
The Somerset side, who were relegated from the Championship last season, are set to net £144,000 in TV funds along with the prize money on offer for progressing.
Yeovil manager Gary Johnson told BBC Radio 5 Live: “The pressure was on because everyone in Somerset wanted Manchester United to come down to Huish Park.
“Because of the prize nobody wanted to make a mistake.”
In a nervy encounter for both sides, which followed on from their 1-1 draw last week, Stanley defender Tom Aldred saw his mistimed back-header go just wide of his own post.
And at the other end Brendan Moloney’s sloppy back-pass was intercepted by Marcus Carver before being scrambled away by Yeovil keeper Jed Steer.
The visitors wasted their best chance to go ahead in the second half, when Shay McCartan smacked a powerful effort off the bar and the on-rushing Matt Crooks failed to head in the rebound.
And they were punished minutes later when Gillett picked up a loose ball, controlled it on his chest and coolly slotted home from 20 yards out.
With Stanley still in shock, Sam Foley pushed Yeovil forward and his pinpoint cross from the left wing was headed in by 6ft 5ins former non-league striker Moore.
Johnson added: “When the second goal went in that was when the Yeovil fans could really celebrate because at that point we were in the ascendancy.
“I think all the board of directors were on their knees for 90 minutes, praying that we’d win. They’ll be very proud of their football club.”
Read more at BBC Sport