Swailes' second-half double saw Accies come back from a goal down to send United spinning out of their second cup competition in the space of two weeks.
Hamilton started well and James McCarthy had a shot deflected narrowly past the left post inside the opening minute.
Two minutes later, Warren Feeney pounced onto a defensive error and broke through but Tomas Cerny superbly blocked with his legs.
Hamilton were next on the attack after five minutes when a roving run down the left by Brian Easton released James McCarthy, but Lukas Zaluska rushed off his line to block with his chest.
Accies went close again on 16 minutes when Easton's corner from the right was headed back into the box by Swailes and James Gibson met it on the half-volley, but his effort was cleared off the line.
It was end-to-end stuff by this point and Feeney broke clear down the right flank after 18 minutes with only a brilliant clearance from Trent McClenahan preventing Craig Conway from putting the Taysiders ahead.
But then Rocco Quinn, making an impressive debut, mugged Conway on the edge of his own box and cut inside before sending a curling effort just over the top left corner in 24 minutes.
However, United took the lead after 34 minutes when McCarthy conceded a needless free-kick for a foul of Morgaro Gomis on the edge of the box and Danny Grainger blasted the set-piece into the bottom left corner.
That took the wind out of Hamilton 's sails and United could have added another in 40 minutes when Feeney headed Conway's corner inches past the right post.
Hamilton came out flying for the second half and levelled inside a minute when McCarthy went on a darting run down the left and cut the ball back for Swailes to sweep the ball into the top right corner.
Sean Dillon put United's hearts in their mouths in 52 minutes when his attempted pass back nearly slipped past Zaluska.
But Swailes sealed the win after 55 minutes when he bulleted a header past helpless Zaluska from Easton's corner.
Hamilton should have put the game beyond doubt on 58 minutes when McCarthy put sub Richard Offiong through on goal, but Zaluska superbly blocked the striker's effort.
United came desperately close to equalising in 87 minutes when Gomis' cross from the left was met by captain Lee Wilkie with a point-blank header, but Cerny blocked with his trailing leg.