LUKAS Jutkiewicz swooped in the sixth minute of stoppage time to spare Middlesbrough's blushes and secure a place in the fifth round of the FA Cup.
Danny Hylton's equaliser looked like earning League Two strugglers Aldershot a replay at the EBB Stadium, with the striker cancelling out Jutkiewicz's close-range header two minutes from time.
However, with six minutes of stoppage time signalled after one of the assistants had been forced to retire through injury, Jutkiewicz struck again.
The striker raced clear down the right as he latched on to a long ball and angled a composed low finish into the net via the inside of the post.
Tony Mowbray made seven changes to the side that lost at Leicester, but it was still a strong Middlesbrough side that lined up against their League Two opponents.
Not that you would known it in the first half, however, with Aldershot proving capable and obdurate opponents as they thwarted Boro's attacking ambitions with a minimum of fuss.
Indeed, it was the visitors who threatened first with Danny Rose's tenth-minute free-kick clipping the top of the crossbar.
Boro's first effort came to nothing when Merouane Zemmama drilled a shot straight at the legs of Jamie Young, and the Aldershot goalkeeper produced a much better save seven minutes later to turn Nicky Bailey's header around the post.
Young was at it again midway through the first half, saving a sharp effort from Stuart Parnaby, and his best save before the interval denied Zemmama after he cut in from the left flank. The Moroccan drilled a low shot towards the bottom left-hand corner, but Young flung out a hand to turn the ball around the post.
At the other end, Mowbray's decision to name a three-man defence was causing more problems than it solved, with Seb Hines and Andre Bikey in particular getting themselves into trouble as they attempted to stride out of defence.
The opening 15 minutes of the second half saw the Teessiders fail to carve out a single chance, and Mowbray opted to reshuffle his pack in the 62nd minute with Andy Halliday and Emmanuel Ledesma coming into the fray.
The latter replaced Marvin Emnes, who was booed off as the home crowd voiced their frustration at his ineffectual displays this season.
Young was finally called into action again midway through the second half, saving from Ledesma after the winger latched on to Hines' long ball, but Boro broke the deadlock with seven minutes left.
Adam Reach delivered a hanging cross from the right, and Jutkiewicz climbed highest to loop a header into the corner of the net.
The goal was somewhat harsh on Aldershot, but the visitors looked to have secured a replay two minutes from time. Hylton broke clear down the right and slotted a composed finish beyond Jason Steele.
At that stage, a replay looked inevitable, but Jutkiewicz had the last laugh as he drilled a low strike into the corner in the sixth minute of added time.
Middlesbrough (3-4-2-1): Steele; Hines (Leadbitter 78), R Williams, Bikey; Parnaby, Bailey, Smallwood (Halliday 62), Reach; Zemmama, Emnes (Ledesma 62); Jutkiewicz.
Subs (not used): Leutwiler (gk), McManus, Haroun, Main.
Aldershot (4-2-3-1): Young; Herd, Bradley, Brown, Morris; Hector (Rankine 87), Rose; Cadogan (Mekki 78), Hylton, Vincenti; Reid (Risser 69).
Subs (not used): Morris (gk), Tonkin, Ainsworth, Cooksley.