Manuel Pasqual spared Fiorentina from an embarrassing home defeat to PAOK Salonika by firing home the free-kick that sent the Italians into the Europa League knockout stages.
Mario Gomez, making his long-awaited comeback from injury, fluffed countless chances to score and when the Italians ran out of puff, PAOK hit them on the counter to notch through Maarten Martens.
There was, however, enough time remaining for Pasqual to make it 1-1 and, with PAOK still six points behind them in third and unable to catch up, Fiorentina are guaranteed a place in the last 32.
The Stadio Artemio Franchi crowd might have forgiven Gomez for taking it easy on his first starting appearance since September, but the German striker was determined to impress.
He was central to every attacking move as Fiorentina hammered their opponents and went close to scoring four times in the opening half-hour.
The best of those opportunities saw the former Bayern Munich striker connect with Juan Manuel Vargas' clever volleyed pass only to miss the target due to defensive pressure.
While he enjoyed a breather, Gonzalo Rodriguez kept Panagiotis Glykos busy with an overhead kick from close range after Pasqual's corner had drifted straight to him.
David Pizarro's searing drive was then blocked by Eyal Golasa and, as half-time drew nearer, both Pasqual and Juan Guillermo Cuadrado blasted efforts wide of the mark as PAOK scrambled.
The Greeks looked more focused after the break and enjoyed three chances to take the lead.
First, Dimitris Salpingidis headed over the bar and Golasa blasted wide before Nikos Spyropoulos went close with a swerving effort off his left boot.
Fiorentina soon wrestled back control of the game and, after Nenad Tomovic had tested Glykos, Vargas and Gomez both piled on the pressure with promising shots from distance.
It therefore came as some surprise when PAOK scored the opener 10 minutes from time.
La Viola were caught napping as Stefanos Athanasiadis loped down the left wing and his pass inside to Martens ended up in the back of the net.
Although the result might not have been fatal to their chances of progressing, Fiorentina were desperate to avoid embarrassment in front of their own fans and went all out for the equaliser.
Miguel Vitor's foul on Khouma Babacar offered them the lifeline they needed as it allowed Pasqual to step up and steer an 87th-minute free-kick into the top corner.