The runaway league leaders were 3-2 down with three minutes remaining, but goals from Gary Hooper and Georgios Samaras earned them the points.
There looked to be no sign of the drama to come when Kris Commons put Celtic ahead after just 12 seconds, firing a low shot past Jamie Langfield after good work from Hooper and Anthony Stokes.
The home side should have been out of sight by the interval, with Charlie Mulgrew, Stokes and Hooper all going close.
But Aberdeen weathered the storm and Celtic were made to pay for their profligacy when Scott Vernon levelled on the stroke of half-time after being fed by Josh Magennis.
Eight minutes after the break, the leaders found themselves behind after poor defending by Kelvin Wilson let in Gavin Rae and he fed Magennis (53) who tucked the ball home.
Magennis struck again on the hour to double Aberdeen’s advantage, after getting a touch on Rae’s drive, and Craig Brown’s side looked on course for a famous win in the week the 72-year-old manager announced he would be standing down at the end of the season.
But Celtic refused to lie down and Mulgrew (68) pulled one back with a deflected shot after a goalmouth scramble to give the home supporters hope.
With three minutes left, Hooper levelled after Efe Ambrose’s shot was blocked on the line and Samaras grabbed a dramatic winner in the fourth minute of injury time with an overhead kick.