Accrington Stanley Under-18s suffered late heartbreak as Ben Andreucci converted a 90th-minute penalty to secure Leeds United's progression into the fourth round of this season's FA Youth Cup.
Following their second round victory over Bolton Wanderers, the Reds began sharply and Lewis Trickett should have opened the scoring on four minutes but he could only fire over the crossbar from close range.
However, the deadlock was broken just seven minutes later as Jack Massey drove into the penalty area and rifled a low shot past Darryl Ombang and inside the far corner; the winger's seventh goal of the season.
The hosts grew into the game and Scott Gardner's side began to ask questions of their own, with Stanley goalkeeper Max Clayton forced into making a good save to deny an effort at goal from Connor Douglas.
As Leeds continued to search for an equaliser, Calvin Harper was then allowed both the time and space to superbly lob Ombang to score his 18th goal of the campaign and his fifth in this season's FA Youth Cup.
The 18-year-old looked to have grabbed his second and Stanley's third just minutes before the half-time break but his chipped effort was cleared off the line, with Aaron Pickles also heading over from a corner.
United were handed a lifeline at Thorp Arch in first half injury-time, as a close-range Max McFadden free-kick took a wicked deflection and wrong-footed Clayton to reduce the Reds' lead to just the one goal.
Gardner's men then drew level 10 minutes after the break and McFadden was again involved, as the former Colchester United youngster's corner was steered home at the front post by Marley Wilson.
The hosts continued to pile on the pressure as the game progressed, with Clayton firstly producing an unbelievable save to keep out a James Debayo header before tipping an Andreucci shot over the crossbar.
Stanley's resistance agonisingly lasted until second half injury-time, when Harley Lawton was ruled to have bundled over McFadden inside the penalty area and Andreucci stepped up to convert from the spot.
There was still time for more late drama as Stanley midfielder Emerich Poilly also appeared to be fouled inside the box, but the appeals of the visiting players were waved away by referee Joe Cunningham.
Clayton, Monk (Lawton 76'), Newton, Hall (Gough 90'), Pickles (C), Young, Henderson, Poilly, Massey (Devonport 88'), Trickett and Harper.
Subs Not Used: Riva, Kelly, Smith and Procter.
Yellow Cards: Henderson, Hall and Clayton.