The Group G match ended 1-1 after Steven Boyd’s late strike was cancelled out by Stephen Dobbie moments later.
The Ladbrokes Premiership side had the best of the match and Doonhamers keeper Alan Martin made notable saves from Scott McMann and Ali Crawford.
When it went to penalties Martin started by saving from Grant Gillespie and Danny Redmond.
However, Accies keeper Gary Woods brought his side back into it by saving from Lyndon Dykes and John Rankin
Amid all that, Crawford, Georgios Sarris, Rakish Bingham, Boyd and Darian MacKinnon netted for Accies with Derek Lyle, Dobbie, Kyle Jacobs, Callum Fordyce and Callum Tapping doing likewise for the Championship side.
However, it was settled after David Templeton netted his penalty, when Woods blocked Darren Brownlie’s attempt.
It looked like Accies were going to take all the points when they took the lead in the 87th minute after knocking on the door for most of the second half.
Boyd, on for Alex Gogic, took advantage of a mistake inside the Queens box to rifle in a tremendous drive which gave Martin no chance.
However, it was only a minute or so later when Accies defence got into a tangle and Dobbie rolled the ball into the empty net to take the game to penalties, where the home side came out on top, thanks mostly to Woods.