Dunedin hung on desperately in the final minutes to beat Alhambra-Union at Kettle Park.
The game looked safe for Dunedin when prop Kelsey Miller scored when the pack drove forward for 10m from a lineout.
Dunedin led 31-14 with under 10 minutes left.
But Alhambra-Union had other ideas and seized its chance when fullback Corey McFadzean sprinted 40m for a try.
With three minutes left, first five-eighth Peter Breen scored and the gap was reduced to just five points.
A fired up Alhambra-Union pack settled inside the Dunedin 22m for the final minutes but the Dunedin defence held steady.
Alhambra-Union blew its chances by not nailing points when it dominated the first 15 minutes. A solitary try to winger Chris Guild was not enough.
Alhambra-Union was playing with more urgency and was getting turnover ball at the breakdown.
The game turned in Dunedin's favour when the pack turned over ball inside its own 22m.
Flanker Gareth Evans burst out of the 22m and openside flanker Hugh Blake ran 70m for the try.
Fullback Pera Gibbs kicked three penalty goals and a conversion to give Dunedin a 16-8 lead at the break. It added 15 more points in the first 25 minutes of the second spell.
The best Dunedin forward was prop Miller with his strong defence and his skill with the pick and go.
He was backed by lock Sam Poole and No 8 Gareth Evans. Fullback Pera Gibbs and midfield back Kai Daniel were the other Dunedin backs to stand out.
Prop Scott Manson was the best Alhambra-Union player.
Loose forwards Regan Turoa and Rory Naylor had solid games and McFadzean was the best back.
Dunedin 31 (Kai Daniel, Hugh Blake, Kelsey Miller tries; Pera Gibbs 2 con, 4 pen), Alhambra-Union 26 (Corey McFadzean, Chris Guild, Peter Breen tries; Breen con, 3 pen). Halftime: Dunedin 16-8.