This game was played at the third attempt after Motherwell's troubled pitch had forced two previous call-offs, but the home side may have wished it had been called off again as six minutes of madness in the second half saw them crash out of the competition.
Dundee made the better start and the saw two early strikes from Derek Lyle and Scott Robertson slide wide of the post.
Motherwell were struggling to find any of the fluency they have become known for this season. They almost clawed themselves into the game when a Ross McCormack corner was met by the head of Brian McLean, but the ball sailed over.
Minutes later they came close once again when McCormack cleverly lifted a free-kick over the defensive wall for David Clarkson, but the striker's shot was weak and provided an easy save for Ludovic Roy.
Motherwell were punished for not taking advantage of their possession when Dundee opened the scoring after only four minutes of the second half.
Bob Davidson crossed from the left and Graeme Smith in the Well goal flapped at the ball, which then fell kindly for Paul McHale, who picked his spot to fire high past the stranded keeper.
Six minutes later they had doubled their lead, this time it was Kevin McDonald who crossed from the left. It was met at the near post by Lyle and his mis-hit shot fell kindly for Scott Robertson to sidefoot home from close range.
Well immediately made a double substitution and it paid off, with Darren Smith pulling one back with virtually his first touch. He rose well to power a header high past Roy from a McCormack corner to set up a grandstand finish.
It was backs to the wall for Dundee from then on and their situation was made worse when they were reduced to ten men and then nine in the last ten minutes.
The first to see a second yellow was McDonald for a foul on Hughes and he was followed by Gary McKenzie for a trip on Stephen Craigan.
Despite this Dundee held on comfortably enough and ran out deserved winners to take on Queen of the South in the quarter-finals.