Ryan One was the Hamilton hero as he fired them into the SPFL Trust Trophy final, but Accies needed extra-time to see off League One Queen of the South.
Accies looked to be cruising through when Dario Zanatta gave them the lead midway through the first half, and they should have added to that.
But Ross Irving levelled late on for Queens, forcing another half-hour.
But 16-year-old One popped up in the first period of extra time to slot a through ball into the let corner.
Queen of the South made the early running and threatened a couple of times through Stephen Hendrie and Michael Ruth, but Hamilton got to grips with the game midway through the first half.
Zanatta fired the Championship side in front and Jean-Pierre Tiehi forced a good save from Kevin Dabrowski in the Queens goal,k who then superbly saved from Scott Martin.
Accies head coach John Rankin made three changes from the side that drew with Dundee. Goalkeeper Jamie Smith, Lewis Smith and Dario Zanatta came in for Ryan Fulton, Connor Smith and Chris McGinn.
His Queens counterpart Marvin Bartley also made three changes, with Ryan Muir, Kieran McKechnie and Connor Murray coming in for Calvin McGrory, Jack Brydon and Lewis Gibson.
Queens did most of the early running and ex-Hamilton defender Hendrie tested Smith with an attempted lob from the left touchline in 12 minutes that the keeper had to take at the second attempt.
Ruth tried again in 19 minutes, but his low shot was well held by Smith in 19 minutes.
But Accies took the lead in 21 minutes when a sweeping move down the right ended with former Hearts star Zanatta blasting the ball past Hibs loanee Dabrowski and into the bottom left corner.
Accies should have doubled their lead in 28 minutes when Lewis Smith sent Tiehi through on goal, but his fierce shot was punched past the right post by Dabrowski.
Midfielder Martin let fly with a rising drive in 32 minutes, but Dabrowski came to the rescue again to touch it over the bar.
Zanatta should have doubled Hamilton's lead in 43 minutes with a tap-in that he somehow fired past the left post, but an offside flag spared his blushes.
Lucas De Bolle had an early chance in the second half, but his shot was superbly punched over by Dabrowkski.
At the other end, Ruari Paton saw a curling shot well held at the bottom right corner.
Paton then sent a free kick inches over from just outside the box in 58 minuts.
Queens were threatening and got their leveller in 72 minutes when Irving’s shot took a deflection and landed in the left corner of the net.
Calvin McGrory stung Smith’s palms in 78 minutes before Accies’ Matty Shiels somehow slipped his low shot past the right post with virtually an open goal in front of him two minutes later.
But Accies scored the winner when One was sent through on goal and he slipped the b all past Dabrowski and into the left corner.
HAMILTON: J. Smith, Owens (Tumilty, 77), McGowan, O'Reilly, Shiels, Martin, Stephenson (Winter, 67), L. Smith (Easton, 90+18), De Bolle, Zanatta (One, 67), Tiehi (McGinn, 77).
Subs (not used): Fulton (GK), Newbury, Latona, Morgan.
Bookings: Tiehi (35), Martin (90+18)
QotS: Dabrowski, East, McKay, Muir (McKenna, 77), Hendrie (McGrory, 64), Todd, Murray (Gibson, 64), Cochrane, McKechnie, Paton, Ruth (Irving, 38).
Subs (not used): Botterill (GK), McKay, Quitongo, Reilly, McMahon.
Bookings: Murray (39), Irving (90+16)
Referee: Craig Napier.
Attendance: 1049.
Follow Lanarkshire Live Sport on Twitter via @LanLiveSport, like us on Facebook or find us on Instagram for the latest sports news, pictures and video.