Derby County 1 Millwall 1
The visitors were heading for a home tie with Brentford or Doncaster when Steve Morison scored in extra time, but Steve Davies rescued the Championship side with his first goal of the season.
Davies then dispatched Derby's first penalty and Millwall's brave challenge ended when Stephen Bywater dived to save Danny Schofield's effort to the relief of the smallest ever crowd at Pride Park.
Derby had made an edgy start after three straight home defeats but Stephen Pearson had a chance to settle their nerves in the 10th minute when Lee Croft sent him clear but he scuffed a shot at keeper David Forde.
Millwall almost increased the anxiety around Pride Park when they broke quickly in the 21st minute but Lewis Grabban could only steer a shot wide under pressure.
Pearson responded with a header that flashed just wide, but Derby's lack of confidence was highlighted when Croft passed square instead of shooting.
Kris Commons fired just wide in first half stoppage time but Derby lacked conviction and they wasted another good chance in the 68th minute.
Pearson got behind Millwall on the left and crossed low to Chris Porter but he volleyed against the underside of the bar from eight yards.
Milllwall had created little but they had openings in the closing minutes of normal time when David Martin broke away down the right only to shoot well wide and then Morison headed straight at Bywater.
The striker should have scored in the 101st minute when Martin crossed but he again put the ball into the keeper's arms and Derby had another escape a minute later when Scott Barron struck a post from 25 yards.
But in the 108th minute, Gary Teale needlessly conceded a corner and after Morison headed against a post, he followed up to score.
The visiting fans were starting to celebrate victory when Davies silenced them in the 114th minute when he cleverly turned past a defender and chipped Forde to level to set up a shoot-out that gave Derby a much-needed victory.