Aamir, 17, hit an unbeaten 73 for his maiden half-century - the highest score by a number ten batsman in a One-Day International - to bring Pakistan, chasing 212, close to an unexpected victory after they were 101-9.
Pakistan were bowled out for 204, giving New Zealand a sensational 2-1 victory in the three-match series. Pakistan won the first match by 138 runs on Tuesday before New Zealand levelled the series with a 64-run win on Friday.
Aamir and Ajmal added a Pakistan record of 103 for tenth wicket but, needing eight off the last over bowled by Jacob Oram, Ajmal holed out for a career-best 33 to end a sensational match.
The previous highest One-day score for a number ten batsman was 56 not out, made by Zimbabwe's Douglas Marillier against India at New Delhi in 2002.
When Ajmal joined Aamir Pakistan needed a mammoth-looking 112 runs in 16.5 overs, but Aamir set the tempo for an unexpected win by hitting Daniel Vettori for three sixes in one over.
Slowly and gradually, he and Ajmal approached the target, beating the previous tenth wicket partnership record by Pakistan in all One-Day Internationals of 72 by Abdul Razzaq and Waqar Younis against South Africa at Durban in 1998.
Aamir, who hit seven boundaries and three sixes during his 81-ball knock, improved on his previous highest score of 24 made against Sri Lanka earlier this year.
In the end New Zealand kept their nerves and did not spoil the early good work by bowlers which saw Pakistan slump from 47-1 to 101-9.
New Zealand captain Daniel Vettori admitted Aamir gave them a scare.
"They played brilliantly for the last wicket, bu we knew that its a matter of just one wicket and then we got it," said Vettori. "It's a great series win and very pleasing."
Earlier, off-spinner Ajmal took a career-best 4-33 to raise hopes of a Pakistan win but Salman Butt (25), Khalid Latif (19), Umer Akmal (12) and Shoaib Malik (11) threw away wickets.
Pakistan got off to a solid 47-run start before Vettori triggered a slump, trapping Latif leg-before in the ninth over. That started the slump.
Captain Younus Khan continued his wretched form, edging Shane Bond to slips after making just three. In the previous over, Younus misjudged a single which resulted in Butt's run out.
Umer Akmal (12), Malik (11), Afridi (five) and Akmal (four) played reckless shots as Pakistan slumped badly.
Younus blamed the loss to lack of early partnerships.
"We didn't have big partnerships and in the end it was sensational to come so close," said Younus who lost his third one-day series as captain since taking over in January this year.
Earlier Brendon McCullum, who scored a brilliant hundred on Friday, stood out once again with an aggressive 78-ball 76 which included three sixes and six fours.
New Zealand were well on course for a big score but once McCullum got out, caught and bowled by Shoaib Malik, Pakistani spinners led by Ajmal sparked a middle-order collapse to take last seven wickets for 47 runs.
New Zealand had raced to 72 by the 12th over, with McCullum reaching his fifty off just 47 balls.
It was paceman Umar Gul who provided the breakthrough, removing opener Aaron Redmond caught off Aamir for 21. This was Gul's 100th wicket in 67 one-day internationals.
Ajmal then came into his own, removing Martin Guptill (eight), Ross Taylor (44), Daniel Vettori (15) and Jacob Oram (two) to improve on his best one-day figures of 2-16 against the West Indies at Johannesburg in September this year.
Ross Taylor, who failed to score in the first two matches, helped McCullum add 50 for the third wicket before Ajmal trapped him leg-before.
Both teams now move to Dubai where they play two Twenty20 matches on November 12 and 13