Whanganui kept the pressure on as Wellington struggled to clear their 22m, and from an attacking scrum, the ball was spread wide for fullback Jordyn Leiasamaivao-Turvey to show good pace down the sideline and crash over in the tackle, with O'Leary raising the flags from touch.
However, at 17-0, Whanganui made some mistakes and gave away penalties to put themselves under pressure, and eventually, Wellington sustained their ruck control to drive over the line and close the gap to 12 before they took the second half wind advantage.
But the visitors would rue losing a man to the sin bin for a no-arms tackle after the resumption.
Whanganui swung onto attack from a scrum win as Namosimalua fed centre Waqa Nalaga, whose offload eventually fell to winger Joshua Brunger to outstrip two cover tacklers and dash from the corner back in towards the posts for an easy O'Leary conversion.
But from here, Wellington came charging as they got a penalty from the kickoff and took a quick tap for a converted try beside the posts.
Whanganui could have sealed it while still facing 14-men, but O'Leary just couldn't quite gather a grubber kick with the tryline open.
Back to full complement, Wellington got a series of penalties and opted for scrums, with the pressure telling as a series of hit-ups towards the posts pulled defenders in, creating the gap out wide to score in the corner.
Wellington also gave away penalties, but O'Leary kept opting for scrums instead of kicking for lineouts that were problematic for throws in the wind, which meant Whanganui had to play in their half.
The visitors got a bit of luck when a partially deflected pass landed perfectly for them to run into the gap and score, although they could not slot the crucial equalising conversion with seven minutes left.
Wellington made another surge deep into Whanganui territory, but this time the hosts stopped the ball runners and earned a series of penalties, getting into Wellington's 22m to run out the clock.
Co-coaches Tony McBride and Te Ahu Teki were planning to work on ball control and discipline this week at training, ahead of the team's away game in Otaki.
Whanganui Under 18's 24 (K Newland, J Leiasamaivao-Turvey, J Brunger tries; S O'Leary pen, 3 con) bt Wellington Samoans U18's 22. HT: 17-5.