Celtic scraped into the last 32 of the Europa League on a night of astonishing drama thanks to a late Rosenborg goal in Leipzig.
With Celtic two down to Salzburg - and Leipzig ahead - the below-par Scottish champions were heading out, until Tore Reginiussen's shock equaliser four minutes from time for the Norwegian side in Germany.
Goals from Moanes Dabbur and Frederik Gulbrandsen - after a horrible Craig Gordon error - had group winners Salzburg in command in Glasgow.
Olivier Ntcham pulled a goal back at the death, scoring the rebound after missing a penalty, but it was Reginiussen's late strike for the section's bottom side that would prove pivotal.
Celtic lost captain Mikael Lustig and Ryan Christie to injury as they chased the game against last year's semi-finalists.
The Parkhead side finish their group campaign on nine points, and join Salzburg in the last-32 draw at 12:00 GMT on Monday.
It was an evening that started with fire and ferocity outside Celtic Park on a frosty Glasgow night. Pyrotechnics and fireworks illuminated the sky in the east end of the city as a group of Celtic's supporters added to what they already knew was an occasion of great importance.
However, that paled in comparison to the sparks that would fly in a spellbinding last 10 minutes at Celtic Park on what was a night of hard toil for the hosts.
For all the illumination pre-match, the home side spent the majority of the game chasing shadows as they simply failed to get to grips with a Salzburg side that relentlessly forced them to retreat deep.
Their cause was not helped as injuries took their toll. First, captain Lustig went off following a head knock, while man of the moment Christie was taken off on a stretcher with his leg in a brace as a result of blocking a shot in the second half. He left the ground on crutches and concern will remain around how long it will be before he returns.
Celtic fans with pyrotechnics outside Celtic Park pre-match
The Austrians were dominant from the start. Fifteen minutes in came the first real warning shot as Diadie Samassekou's header came crashing back off the bar.
After half an hour Kristoffer Ajer - who came on to replace Lustig - almost cost his team with an inexplicable pass straight to Hannes Wolf. He raced in on goal, only for Gordon to pull off a stunning save.
The first half came and went without a shot on target for Brendan Rodgers' men, and the one-way traffic continued after the break despite Scott Brown's introduction for Scott Sinclair.
For all Celtic's resolve before the break, the opener was just too easy for Salzburg. Stefan Lainer had the freedom of Glasgow to swing in a deep cross, with Dabbur splitting the centre-halves and heading in from six yards. Only a terrific save from Gordon would deny him a second four minutes later.
However, there was no preparation for what was to come with 13 minutes to play as Celtic threatened to implode. With the ball in his grasp, Gordon attempted to throw it to Tierney, but only managed to crash it against the loitering Gulbrandsen. The Scotland goalkeeper attempted to recover, but it was too late.
Celtic looked dead and buried and, when Ajer somehow turned the ball over the bar from just two yards out with eight minutes left, the writing was on the wall for the Scottish champions.
But, with all hope lost, something extraordinary happened.
With Celtic Park falling silent, a trickle of excitement, cheering and eventually euphoria began to bounce around the ground as word of Reginiussen's goal reached Glasgow.
It seemed to rouse their team as Celtic began to drive forward and they got their reward when Filip Benkovic was upended in the box by Jerome Onguene. Ntcham's effort from the spot was knocked on to the post by Alexander Walke, only for the Frenchman to turn in the rebound.
In the end, it didn't matter. Moments later a raucous roar erupted once more, heralding full-time in Leipzig. Celtic's early Christmas miracle had arrived.
Former Aberdeen defender Willie Miller on BBC Scotland
We assumed that Salzburg had nothing to play for because they had won the group. We assumed Rosenborg had nothing to play for because they had no chance. And how wrong can you be on both counts. Celtic had to amass the points in the first place. But it was a little bit of good fortune in the end.
It was better in the second half. Rodgers worked hard at half time, got the shape right and Celtic looked a much better force. But the first half was extremely disappointing. Celtic were all over the place. It could have been more embarrassing.