A Dusan Tadic penalty in each half and Nicolas Tagliafico's late header were enough to give Erik ten Hag's side a chance to make the group stage and relive the dream of last season, when they seduced Europe with a thrilling run to the last four.
Serb Tadic, who had already missed once from the spot for Ajax, slotting home the equaliser two minutes before the break after Diego Biseswar had silenced the Johan Cruijff Arena with a fine strike for PAOK midway through the half.
Tagliafico left the Greeks needing to score twice to go through with 11 minutes to go when he met Ziyech's corner with a powerful header, and shortly after Tadic ensured a playoff clash with APOEL Nicosia before September's group stage, despite Biseswar's stoppage time strike.
APOEL will face the DUtch ginats after overturning a 2-1 deficit from the first leg to win 2-0 at Qarabag thanks to goals from Tomas De Vincenti and Urosh Matich.
Elewhere former European champions Porto, Celtic and Red Star Belgrade were dumped out with respective defeats to Krasnodar, CFR Cluj and FC Copenhagen, with the Glasgow outfit sent into the Europa League 5-4 on aggregate after losing a thrilling encounter 4-3 at Celtic Park.
Porto meanwhile found their 1-0 first leg lead wiped out as Russian side Krasnodar scored three times in 33 minutes to take control of the tie.
The two-time kings of Europe pulled level on aggregate in the second half thanks to goals from Ze Luis and Luis Diaz, but couldn't find the winner despite having 25 shots and exit the competition on away goals.
Red Star fell to a 7-6 penalty shootout defeat that featured 19 spot kicks, after the Serbs could not be separated from their Danish opponents over two legs.
Club Brugge squeezed through following a dramatic 3-3 draw at Dynamo KIev that saw three late goals -- including two in stoppage time -- scored and each side finish with 10 men as the Belgians made it to the playoffs 4-3 on aggregate.