Hibernian climbed up to fifth in the table with a second-half fightback at Easter Road.
Trailing to a Zander Diamond goal in the first half, the Edinburgh side struck twice in the opening ten minutes of the second half through Merouane Zemmama and Dean Shiels, before Steven Fletcher finished it off in injury-time.
But Hibs rode their luck at times and had goalkeeper Yves Makaba-Makalamby and the woodwork to thank for the victory.
Scott Severin almost drew first blood for Aberdeen with a speculative shot from distance after only 80 seconds which Makaba-Makalamby did well to turn away for a corner.
Shiels then picked out Fletcher with an astute cross-field pass but the striker, who had scored a hat-trick in midweek against Gretna, could not adjust his footing and sent his 18-yard shot curling away from goal.
The Aberdeen response was swift. Makaba-Makalamby was unconvincing at dealing with a Chris Maguire cross, but redeemed himself to get a boot to Jeffrey de Visscher's 15-yard follow-up shot.
The goal arrived after 18 minutes. Colin Nish was caught loitering in his own penalty area at a de Visscher corner and it gave Diamond the chance to pilfer the ball and thrash it over Makaba-Makalamby.
If that defending was untidy then it was even more shambolic moments later when it took an instinctive save from Makaba-Makalamby to palm a header from Chris Hogg - his own defender - onto the face of the crossbar and eventually to safety.
Aberdeen controlled for long periods in the first half and their movement pulled and stretched Hibs and always seemed to leave them with a spare player.
Barry Nicholson kept Makaba-Makalamby on his toes with a shot from distance and then the goalkeeper managed to get down smartly to block an Alan Maybury shot.
If Aberdeen dominated the first half, then Hibs turned the game on its head with two goals in the opening ten minutes of the second half.
Zemmama curled home a 20-yard free-kick after 49 minutes after Nish had won what had looked like a soft free-kick.
Before Aberdeen had time to recover, Fletcher switched the ball into the path of Shiels and, although Jamie Langfield blocked his first effort, the midfield player lofted the rebound high into the net.
Fletcher could have made it 3-1 after 75 minutes when he was put through by substitute Filipe Morais, but Langfield was out quickly to block.
Aberdeen substitute Stuart Duff cracked a shot off the crossbar with seven minutes left before Hibs scrambled the ball clear.
Fletcher had the final say as he headed in a cross from John Rankin to complete the scoring deep into injury-time.