AC Milan crashed out of the Europa League as Konstantinos Fortounis' late penalty claimed a 3-1 win for Olympiacos, sending the Greek side through to the knockout stages.
Gennaro Gattuso's men required just a point to secure progression from Group F, but they found themselves behind when Pape Abou Cisse headed in on the hour.
With Milan's defence rocking, Olympiacos grabbed a crucial second goal when Cristian Zapata deflected Guilherme's hopeful strike into his own net nine minutes later.
Zapata immediately made amends when he bundled the ball in at the other end to make it advantage Milan courtesy of their improved head-to-head record, but, after Ignazio Abate was penalised for holding onto Vasilis Torosidis, Fortounis kept his cool to book Olympiacos' place in last 32.
Olympiacos could have been ahead inside 10 seconds, but Pepe Reina got a vital touch to Guerrero's scuffed shot.
Jose Sa was on form to deny Gonzalo Higuain, Tiemoue Bakayoko and Patrick Cutrone as Milan gained a foothold, though it was Olympiacos who broke the deadlock 15 minutes after the restart.
Reina was caught in no-man's land from a corner and, despite Higuain making a goal-line block, Cisse was on hand to head home the rebound. Reina atoned for his mistake with a brilliant save from Daniel Podence moments later, only for Milan's goalkeeper to be beaten again when Guilherme's shot looped in off Zapata.
But although the Milan defender more than made up for it two minutes later when his header trickled over the line, it was Olympiacos who had the final say.
Abate needlessly dragged down Torosidis and Fortounis duly sent Reina the wrong way from 12 yards to secure the hosts' first competitive win over the Rossoneri.