Heerenveen fought back from a 2-1 deficit with two late goals, including an extra-time winner from Tibor Halilovic that gave them a narrow advantage.
Sydney van Hooijdonk opened the scoring for the hosts in the 58th minute but their lead lasted barely 60 seconds as Hakon Evjen equalized for AZ.
Greek star Vangelis Pavilidis then put them 2-1 in front another six minutes later and were supposedly on their way to a victory.
Amin Sarr, however, popped up with a 90th-minute leveler for De Superfriezen, before Halilovic struck the winner in the fifth-minute of stoppage time.
AZ Alkmaar vs Heerenveen Head-To-Head
AZ have won 24 of their last 51 clashes with Heerenveen, losing 17.
The 3-2 defeat in the first leg also ended De Kaasboeren's run of five consecutive victories in the fixture.
AZ Alkmaar Form Guide (all competitions): L-L-D-D-D
Heerenveen Form Guide (all competitions): W-W-L-W-D
AZ Alkmaar vs Heerenveen Team News
Captain Owen Wijndal was missing in action on Thursday due to a problem with his groin and will be assessed once again before the return leg.
Hungarian midfielder Milos Kerkez left the field with a knee injury and questions remain over Yukinari Sugawara's availability too.
Jeremy Helmer missed the first leg through injury.
Injured: Owen Wijndal, Milos Kerkez, Yukinari Sugawara, Jeremy Helmer
Joost van Aken, Nick Bakker and Pawel Bochniewicz will remain absent for De Superfriezen through injuries.
Head coach Ole Tobiasen shouldn't make too many changes to his side from the last time, with Amin Sarr and Sydney van Hooijdonk leading the line.
Injured: Joost van Aken, Nick Bakker, Pawel Bochniewicz
AZ Alkmaar vs Heerenveen Predicted XI
AZ Alkmaar (4-2-3-1): Peter Vindahl Jensen; Aslak Fonn Witry, Pantelis Chatzidiakos, Bruno Martins Indi, Tijjani Reijnders; Fredrik Midtsjø, Jordy Clasie; Håkon Evjen, Dani de Wit, Jesper Karlsson; Vangelis Pavilidis.
Heerenveen (5-3-2): Erwin Mulder; Milan van Ewijk, Sven van Beek, Ibrahim Drešević, Lucas Woudenberg, Rami Kaib; Tibor Halilović, Thom Haye, Anas Tahiri; Amin Sarr, Sydney van Hooijdonk.
AZ Alkmaar vs Heerenveen Prediction
AZ, coming into the match with a deficit, will come flying out of the blocks here, having also generally looked strong on home soil.
Heerenveen can expect another tough match but they do not look likely to throw away the advantage.
The home side could win but lose out on the away goals rule.
Prediction: AZ Alkmaar 2-1 Heerenveen
Paul Merson has predicted Manchester United vs Liverpool and other PL GW3 fixtures! Click here