Surrey will now face Northamptonshire in the final later Saturday after the Steelbacks defeated Essex in the first semi-final at the Birmingham ground.
All-rounder Mascarenhas, who has won five trophies in his 18 years with Hampshire, is retiring at the end of the season following a persistent Achilles problem.
But the chances of the 35-year-old, born in London but brought up in Australia and who made 34 limited overs appearances for England, adding to his medal collection Saturday were effectively ended when Surrey held Hampshire to 142 for nine, with paceman Mahmood taking two wickets for nine runs in four overs.
However, it was ex-England seamer Jon Lewis who had Hampshire's Michael Carberry, the competition's leading runscorer, caught at cover-point for just six.
As drizzle set in, Surrey found the run chase tough before Zander de Bruyn (41 not out) saw them home in the final over.
Earlier, Australia's Cameron White helped Northamptonshire complete their remarkable run to a first Twenty20 final with a seven-wicket win over Essex.
Before this season, the Steelbacks had won just three of their previous 22 Twenty20 matches but an unbeaten 78-run stand between White and Steven Crook saw them pass Essex's 168 for five with 11 balls to spare.
South Africa Twenty20 international Richard Levi got Northamptonshire's reply off to a sound start with 57 from 35 balls at the top of the order before White (36 not out) and Crook (46 not out) sealed victory.