The Sky Blues had looked to be coasting into the last four as they stormed into a three-goal lead after half an hour thanks to goals from David Munster, Johnny Taylor and Darren Boyce.
But an early second half goal from former Ballymena striker Gary Liggett sparked a tremendous Dungannon fightback before Boyce’s second goal late on sent Glenn Ferguson’s side through.
United got off to the best possible start with a goal after just 90 seconds.
Tony Kane swung in a free kick from the right and defender David Munster arrived unmarked to head home via the inside of the post.
Buoyed by that early boost, United again went close when Alan Teggart played a neat one-two with Alan Davidson and the winger’s fierce shot was beaten out by Swifts keeper Gareth Buchanan. From the rebound, Jim Ervin went down under a challenge from Fra Brennan but referee Ross Dunlop remained unmoved.
Ballymena’s early dominance con tinued with Buchanan tipping Alan Davidson’s daisy-cutter around the post and from the resultant corner, Darren Boyce blazed a volley over the bar.
And a second goal duly arrived on 22 minutes.
This time it was Munster’s central defensive partner Johnny Taylor who was on the scoresheet, rising at the near post to head home Kane’s inswinging corner, amid more pitifully bad Dungannon marking.
And the home fans were in dreamland on the half hour as United extended their lead with a third headed goal, this time Darren Boyce timing his run neatly to glance Jim Ervin’s pinpoint centre past a despairing Buchanan.
It could have been game, set and match six minutes before the interval when Jim Ervin broke up an attack and threaded a through ball for Cushley to race clear.
United’s 15-goal top scorer, typically, opted for power but Buchanan made a marvellous save to touch the shot over the crossbar.
Dungannon rarely threatened but they should have pulled a goal back in the last minute of the first half when David McCullough headed against the bar from virtually on the goal-line and Munster threw himself full-length to divert Gary Liggett’s follow-up effort over the bar for a corner.
United almost made it four in first half stoppage time when Cushley made space before seeing his low shot touched onto the base of the post by Buchanan.
Dungannon desperately needed an early second half goal to have any hope of salvaging the tie and they got one within eight minutes of the restart. Johnny Taylor did brilliantly to hook Gary Liggett’s initial header off the line but the former Ballymena striker followed up to head the rebound, with the referee’s assistant adjudging that the ball had crossed the line before Taylor could head clear.
The Tyrone side almost reduced the deficit further on 72 minutes when Fra Brennan volleyed against the crossbar from a corner with Ballymena desperately scrambling clear.
And with United nerves jangling, Chris Lavery headed David McCullough’s cross straight into keeper Aaron Shanahan’s chest.
But as Dungannon threw numbers forward they were always susceptible to a Ballymena counter-attack and with four minutes left, Alan Davidson did well before unselfishly squaring to fire past Buchanan high into the net to finally settle the tie in Ballymena’s favour.
Ballymena United: Shanahan, Ervin, Munster, Taylor, McBride, Kane, Davidson, Jenkins (sub Taggart 86), Teggart (sub Stewart 81), Boyce, Cushley (sub Kelly 89). Subs (not used): McCullagh, McLellan.
Dungannon Swifts: Buchanan, McCullough, Brennan, McMinn, McCaffrey, Hazley (sub Glackin 65), Tomelty, Hutchinson, Harpur, Topley (sub C Lavery 57), Liggett (sub S Lavery 64). Subs (not used)Turker, Brolly.
Referee: Ross Dunlop (Carrickfergus).