Match ends, Dundee 2, Dundee United 1.
Dundee got the better of city rivals Dundee United to reach the Scottish League Cup quarter-finals.
A stunning Faissal El Bakhtaoui strike deservedly put Dundee ahead but Billy King equalised from close range before the break.
Paul McGowan's controlled finish put the hosts back in front.
King had another chance to level matters but dragged his shot wide while goalkeeper Scott Bain was stranded off his line.
Dundee will host Celtic in the next round.
These sides, who had met in the first-round group stage, had contrasting beginnings to their league season at the weekend, Dundee losing at home to Ross County in the Premiership, United winning away at Inverness in the Championship. Neil McCann had bemoaned his side's shortage of physicality in that defeat, but that was just one of the fixes he put in place in the early stages.
Dundee had to live without their suspended captain, Darren O'Dea, and their chief striker, Sofien Moussa. Marcus Haber came in for Moussa and Haber had the size and aggression to unsettle United all night long.
The home side lorded it over over the opening 40 minutes. Haber had a header just wide, then his forward partner, El Bakhtaoui, lashed one over. Dundee had a lovely edge and tempo to them, pinning United back, starving them of possession.
El Bakhtaoui should have opened the scoring after 20 minutes. He created the chance all by himself when ransacking William Edjenguele and running on to face Harry Lewis one-on-one. The thing that made McCann go potty on the touchline was not just that his striker failed to convert but that he failed to even hit the target, pulling his shot wide.
To say that El Bakhtaoui made amends would be putting it mildly. He was wonderful. His work-rate was off the charts.
On the half-hour, he collected a clearing header from a Dundee corner, composed himself with a touch and smashed a shot past Lewis, the ball finding the net off the underside of the goalkeeper's crossbar. For Kieran Tierney for Celtic against Kilmarnock on Tuesday, read El Bakhtaoui for Dundee on Wednesday.
Dundee kept their momentum up until five minutes before the break when United suckered them. Again, it was great execution, created by Sam Stanton's run and drilled cross and finished by King, who arrived at the back post to drill home.
The breathless nature of the tie carried on and on. Having been sickened by that equaliser, Dundee got back to work with an intensity that eventually brought a breakthrough. Rorie Deacon, a whirling dervish of a player out wide, crossed from the right to Scott Allan, who was cool in the moment, laying it off to McGowan. The midfielder hit a sumptuous shot high past Lewis.
As they pushed for a third goal, Haber's header, from an El Bakhtaoui cross, forced a fine save from Lewis. It was absorbing stuff. Rugged, narky, engaging. United launched men forward looking for the equaliser and came painfully close when Bain got in a muddle and presented a chance to King, who could not take advantage.
They could not create another. Dundee advanced and they deserved to on a night when the city delivered another thumping derby.
Dundee manager Neil McCann: "I thought we absolutely dominated the match from start to finish.
"We knew United, like every team will do, would have a little spell and they have some good threats.
"Disappointed with the goal, but overall I thought that was a flattering scoreline.
"I was so happy for Faissal because he's got thunder in his boots and he just needs to believe in himself a wee bit more and feel he belongs here.
"But, my goodness, he is a threat, but I thought, to a man, we were absolutely brilliant.
"I am delighted we've got a home tie and we've pulled the strongest side in the country, but if you want to win it, you've probably got to beat them sometime."
Dundee United manager Ray McKinnon: "I think in the first 30 minutes, Dundee were better than us.
"We moved our players around and I thought the game levelled out and we scored a really good goal.
"Going in at half-time we were feeling really good about things and the second half was more even.
"Both sides had chance, but we've undone ourselves with some slack defending.
"Congratulations to Dundee, but there's lots of positives from us as that game could have gone either way in the second half."
- 34WaddellBooked at 32mins
- 18McGowanBooked at 79mins
- 21DeaconBooked at 57minsSubstituted forWoltersat 76'minutes
- 10AllanSubstituted forVincentat 85'minutes
- 20El Bakhtaoui
- 14EdjengueleBooked at 90mins
- 3ScobbieSubstituted forRobsonat 18'minutes
- 20BrielsSubstituted forKeatingsat 73'minutes
- 23FyvieSubstituted forMurdochat 85'minutes
- 11KingBooked at 62mins
- Steven McLean
- Shots on Target
Second Half ends, Dundee 2, Dundee United 1.
Attempt missed. Paul McMullan (Dundee United) right footed shot from the left side of the box is close, but misses the top right corner.
William Edjenguele (Dundee United) is shown the yellow card for a bad foul.
Glen Kamara (Dundee) wins a free kick in the defensive half.
Foul by William Edjenguele (Dundee United).
Foul by James Vincent (Dundee).
Samuel Stanton (Dundee United) wins a free kick in the defensive half.
Foul by Faissal El Bakhtaoui (Dundee).
Paul McMullan (Dundee United) wins a free kick on the left wing.
Substitution, Dundee. James Vincent replaces Scott Allan.
Substitution, Dundee United. Stewart Murdoch replaces Fraser Fyvie.
Attempt saved. Billy King (Dundee United) left footed shot from the right side of the box is saved in the bottom left corner.
Attempt blocked. Randy Wolters (Dundee) right footed shot from outside the box is blocked.
Attempt missed. Billy King (Dundee United) left footed shot from outside the box is close, but misses to the right.
Corner, Dundee. Conceded by Billy King.
Paul McGowan (Dundee) is shown the yellow card for a bad foul.
Foul by Paul McGowan (Dundee).
Billy King (Dundee United) wins a free kick in the defensive half.
Foul by Randy Wolters (Dundee).