Nadir Ciftci came off the bench to fire Dundee United into the Scottish League Cup third round as he scored twice and set up another to see off Dumbarton.
Kevin Smith's first-half strike put the Sons ahead, but Ciftci fired home the equaliser after 69 minutes.
He set up Ryan Gauld to put the Premiership side in front.
Mitch Megginson scored a wonderful late equaliser, but Ciftci soon hit an 89th-minute winner to deny the Championship outfit the chance of extra time.
United had created numerous chances in the opening 15 minutes and Goodwillie sent a free header wide from a Mark Wilson cross.
Brian Graham had a volley well saved by Jamie Ewings following Andrew Robertson's cross.
Robertson sliced wide after being set up by Gauld, while Bryan Prunty glanced a header wide at the other end.
United could not maintain their early pressure, but they looked to be in little danger themselves until the 33rd minute.
Dumbarton right-back Paul McGinn sent a ball into Smith from the halfway line and the forward turned John Souttar and shot past the onrushing Radoslaw Cierzniak with the United defender only helping the ball into the net as he tried to atone for his error.
United almost levelled instantly when Gauld hit a swerving 30-yard effort that bounced off the bar.
Graham missed a late first-half chance and United hit the frame of the goal again 10 minutes after the break through a Paul Paton drive.
Barry nearly scored at the other end, but Robertson blocked his volley in the goalmouth just before United manager Jackie McNamara introduced Ciftci for Wilson in the 63rd minute.
Six minutes later, Ciftci chested the ball inside Scott Smith after the Sons left-back misjudged Paton's diagonal ball and the winger volleyed home inside the near post.
Ciftci set up the second when he used his pace and strength to make the bye-line before cutting it across goal.
Gauld's first effort was blocked, but the teenager had time to take a touch before rifling the rebound into the net from close range.
United sat back and Megginson made them pay with four minutes left when he curled the ball into the far top corner.
Parity lasted only two minutes as both United substitutes combined to win the tie, Chris Erskine cutting inside from the right wing and playing a reverse pass to Ciftci to fire home from 10 yards.
Live Text Commentary
Full Time The match has reached full-time.90:00 +1:26
Calum Butcher makes a clearance.90:00 +1:23
Corner taken by Chris Turner from the right by-line.89:45
Shot by Chris Erskine went over.88:44
Brian Graham provided the assist for the goal.88:44 Goal scored
Goal! - Nadir Ciftci - Dumbarton 2 - 3 Dundee U Nadir Ciftci scores with a right foot finish. Dumbarton 2-3 Dundee Utd.87:09
Chris Turner takes the free kick.86:55
Paul Paton gives away a free kick for an unfair challenge on Hugh Murray.86:20
Aaron Barry provided the assist for the goal.86:20 Goal scored
Goal! - Mitchel Megginson - Dumbarton 2 - 2 Dundee U Mitchel Megginson scores with a right foot finish. Dumbarton 2-2 Dundee Utd.85:58
Aaron Barry takes the free kick.85:33
Chris Erskine concedes a free kick for a foul on Andrew Graham.82:50 Substitution
Substitution Mark Millar is brought on as a substitute for Ryan Gauld.81:45
Free kick taken by Jamie Ewings.81:23 Booking
The referee shows Paul Paton a yellow card for unsporting behaviour.81:16
Free kick awarded for an unfair challenge on Mitchel Megginson by Paul Paton.80:32
Corner from the left by-line taken by Chris Turner.78:50 Substitution
Substitution Alistair McKerracher on for Scott Smith.78:15 Substitution
Substitution Colin Nish comes on in place of Steven McDougall.
Goal! - Ryan Gauld - Dumbarton 1 - 2 Dundee U Ryan Gauld grabs a goal with a right foot finish. Dumbarton 1-2 Dundee Utd.75:55 Substitution
Substitution David Goodwillie leaves the field to be replaced by Chris Erskine.73:59
Jamie Ewings restarts play with the free kick.73:52
Foul by Brian Graham on Andrew Graham, free kick awarded.72:28
Free kick taken by Chris Turner.72:01
Calum Butcher gives away a free kick for an unfair challenge on Bryan Prunty.71:25
Shot by Paul Paton went over the net.69:52
Free kick taken by Hugh Murray.69:36
Scott Smith fouled by Nadir Ciftci, the ref awards a free kick.68:39
The assist for the goal came from Andrew Robertson.68:39 Goal scored
Goal! - Nadir Ciftci - Dumbarton 1 - 1 Dundee U Nadir Ciftci grabs a goal with a right foot finish. Dumbarton 1-1 Dundee Utd.66:46 Substitution
Substitution Mitchel Megginson on for Garry Fleming.63:00 Substitution
Substitution Nadir Ciftci replaces Mark Wilson.62:05
Aaron Barry has an effort at goal. Blocked by Calum Butcher.61:58
Corner taken by Steven McDougall from the right by-line.61:13
Free kick taken by Chris Turner.61:01
Bryan Prunty fouled by Ryan Gauld, the ref awards a free kick.60:04
Free kick taken by Chris Turner.59:57
Brian Graham handles the ball and concedes a free kick.59:44
Jamie Ewings takes the free kick.59:31
Free kick awarded for an unfair challenge on Kevin Smith by Ryan Gauld.57:47
Chris Turner takes the free kick.57:18
Calum Butcher gives away a free kick for an unfair challenge on Kevin Smith.55:08
Paul Paton takes a shot and struck the post.52:57
Corner from the left by-line taken by Ryan Gauld.51:09
Free kick taken by Paul Paton.51:03
Free kick awarded for an unfair challenge on Mark Wilson by Scott Smith.49:39
Ryan Gauld crosses the ball in from the free kick.48:54
Free kick awarded for a foul by Scott Smith on David Goodwillie.45:01
The game restarts for the second half.45:00 +0:59 Half time
Half Time The ref blows to signal half-time.45:00 +0:32
Brian Graham takes the chance to get an effort at goal and missed to the left of the net.44:05
Jamie Ewings restarts play with the free kick.43:45
Unfair challenge on Aaron Barry by Brian Graham results in a free kick.43:38
Corner taken by Ryan Gauld from the left by-line.43:20
Hugh Murray makes a clearance.43:12
Corner from the right by-line taken by Ryan Gauld.43:03
Clearance by Aaron Barry.42:55
Corner taken by Ryan Gauld.39:44
Shot by Andrew Robertson cleared the bar.37:10
Andrew Graham manages to make a clearance.37:05
Corner taken by Ryan Gauld from the left by-line.36:33
Ryan Gauld takes the chance to get an effort at goal and hits the bar.33:25 Goal scored
Goal! - Kevin Smith - Dumbarton 1 - 0 Dundee U Kevin Smith scores with their left foot. Dumbarton 1-0 Dundee Utd.30:36
Jamie Ewings takes the free kick.30:19
Brian Graham goes into the referee's book.30:19 Booking
Jamie Ewings restarts play with the free kick.25:28
The offside flag is raised against Paul Paton.24:10
Header at goal by Brian Graham. Jamie Ewings safely holds on.24:04
The ball is sent over by Andrew Robertson.23:47
Headed chance falls to Aaron Barry. Radoslaw Cierzniak safely holds on.23:40
Free kick crossed by Garry Fleming.22:57
Free kick awarded for a foul by John Souttar on Bryan Prunty.21:11
Andrew Robertson produces a cross.19:05
Andrew Graham makes a clearance.19:00
Ryan Gauld crosses the ball in from the free kick.18:30
Free kick awarded for an unfair challenge on Andrew Robertson by Paul McGinn.18:21
Free kick taken by Andrew Robertson.18:06
Handball decision goes against Paul McGinn.17:08
John Souttar takes the free kick.17:02
The assistant referee flags for offside against Kevin Smith.15:19
Corner taken by Ryan Gauld.12:41
Jamie Ewings makes a clearance.12:35
The ball is crossed by Ryan Gauld.11:32
Shot by Andrew Robertson missed to the right of the target.10:13
Brian Graham takes the chance to get an effort at goal. Jamie Ewings catches the ball.10:08
The ball is sent over by Andrew Robertson.6:47
Header by David Goodwillie misses left.6:36
Mark Wilson crosses the ball.5:29
Andrew Robertson restarts play with the free kick.5:21
Foul by Andrew Graham on Ryan Gauld, free kick awarded.4:50
Calum Butcher makes a clearance.4:44
Corner from the left by-line taken by Steven McDougall.3:57
Scott Smith takes the free kick.3:49
Brian Graham gives away a free kick for an unfair challenge on Hugh Murray.3:32
Free kick taken by Jamie Ewings.3:12
Brian Graham is ruled offside.0:00
The game kicks-off.
Live data and text provided by our data suppliers