Brian Rice breathed a sigh of relief after Hamilton came from two goals down to see off Airdrieonians – but warned he never again wants to see a display as bad as the one his team produced in the first half at the Penny Cars Stadium.
The visitors looked down and out after Callum Smith and Ally Roy fired the dominant League One side into the lead, only for Ross Cunningham to bring Hamilton level soon after the restart with two goals from the penalty spot.
And the Premiership side's winner arrived in the 89th minute in sensational style, as Marios Ogkmpoe volleyed the ball in off the underside of the crossbar to seal second spot in Group F – and a place in the last 16 of the Betfred Cup.
Accies boss Rice said: "That first half was as poor as I've seen since I've been at the club. I never want to see a first half like that again.
"We lacked energy and enthusiasm and Airdrie were all over us. We looked like a bunch of strangers out there.
"I told the players they were letting themselves down and letting the fans down. I asked for more, and credit to them for going out and getting the result."
On striker Ogkmpoe's stunning last-gasp winner, Rice added: "Marios is a young guy who hasn't played a lot of football – and I'm delighted for him today. It was a wonderful goal."
Airdrieonians manager Ian Murray said: "I'm disappointed with the result, of course, but not the performance. We had a lot of positives to take from that.
"For long spells it certainly didn't look like League One against Premiership out there."