A try three minutes into injury time from Voliami Koroi has saved the All Blacks Sevens from their first-ever exit in the pool stage of a World Sevens men's tournament.
The Kiwis had to come from behind against hosts South Africa to win 26-21 to clinch a quarter-final berth at the Cape Town Sevens on Sunday morning (NZ time).
A loss to South Africa would have sent the Kiwis crashing out a week after winning the Dubai Sevens crown. In the series' 20-year history, New Zealand has never missed out on the quarter-finals.
South Africa scored the game's opening try through Rosko Specman, but New Zealand hit back with two of their own through Andrew Knewstubb and captain Sione Molia for a 14-7 halftime lead.
But tries to Werner Kok and Branco du Preez gave South Africa the lead, and they were set for victory.
Molia then scored his second just before the fulltime siren to level the match a 21-21 meaning there was enough time for one play.
Earlier in the day, New Zealand won their opened their campaign with a comfortable 35-0 win over Zimbabwe in their opening match.
Knewstubb scored the only try in the host half as the All Blacks Sevens led 7-0 at the break. Scott Gregory and Luke Masirewa both scored braces in the second half to set up the convincing win.
Things then went downhill for the Kiwis as they slumped to a 21-17 loss to Samoa. It's the first time Samoa have beaten New Zealand under Sir Gordon Tietjens, former All Blacks Sevens boss.
Samoa opened the scoring through Alamanda Motuga, but New Zealand responded with tries to Sione Molia and Tone Ng Shiu to lead 12-7 at halftime.
David Afamasaga's try for Samoa put them back in the lead, but New Zealand responded when Molia scored his second in the final minute of the match to set up a thrilling finish.
But Tila Mealoi scored a length-of-the-field try after the fulltime siren, Samoa claiming a rare win over New Zealand.
The All Blacks Sevens finished second in their pool, and will face Australia in the quarter-finals.