Sergio Romero saved Manchester United from an embarrassing exit in the EFL Cup as Ole Gunnar Solskjaer's side needed penalties to knock out third-tier Rochdale after a 1-1 draw.
Mason Greenwood put United in front in the second half on Wednesday, the teenager scoring for the second week in a row after netting the winner against Astana in the Europa League.
But the League One side stunned Old Trafford with an equaliser scored by 16-year-old Luke Matheson, who was set up by United academy product Ollie Rathbone.
That sent the game to penalties and when Romero kept out Jimmy Keohane's effort, Daniel James was able to convert United's last kick and complete a 5-3 shoot-out victory.
Paul Pogba, making his first appearance of the month after an ankle injury, wasted two early efforts then Robert Sanchez made a fine block to keep out Marcos Rojo's header.
The France midfielder was performing poorly, missing a six-yard sitter of a header from Greenwood's cross before smashing a long-range strike well over the crossbar.
Rochdale made it to the break after Jesse Lingard's header flew narrowly over and they should have taken the lead in the 52nd minute when Rathbone did brilliantly to tee up Callum Camps only for his mishit shot to be cleared off the line by Aaron Wan-Bissaka.
With the tempo rising United soon went close twice at the other end through Greenwood, but he would not be denied in the 68th minute.
Collecting a pass from Lingard on the right side of the box, Greenwood cut inside on to his left foot and rifled a low shot past Sanchez to bring Old Trafford to its feet.
Rochdale incredibly drew level within eight minutes, though, as Rathbone's high cross turned home at the back post by teenager Matheson.
Brian Barry-Murphy's side could not complete one of the great cup upsets as Romero made the key save to put United through to the fourth round, where they will face Chelsea at Stamford Bridge next month.