Malinga produced a sensational spell of death bowling, picking up key wickets at crucial junctures, to ensure the win for his side with seven balls to spare at the Khan Shaheb Osman Ali Stadium.
Chasing an impsoing 297 for victory, Pakistan were on course for a remarkable victory before Malinga came up with a fiery spell to bowl out the 'Men in Green' for 284 in 48.5 overs.
Earlier, Thirimanne struck a fine 110-ball 102 to power Sri Lanka to a challenging 296 for six.
Thirimanne hit 11 fours and a six in his innings and starred in a 161-run stand with Kumar Sangakkara (67) for the second wicket to lay the foundation for a huge score.
Also Read
Pakistan tried to make a comeback in the middle overs as they picked up a few wickets, before skipper Angelo Matthews provided the late charge, cracking a 50-ball 55, to take Sri Lanka close to the 300-mark.
Both added 121 runs for the fifth-wicket partnership to bring Pakistan back into the game but Malinga held his nerves and produced a match-winning spell to grab full points for his team.