After declaring on their overnight total of 247 for six to set Zimbabwe 412 for victory on the final day, Sri Lanka were under threat of being held to a draw as Graeme Cremer once again proved to be the thorn in their side with his stubborn 43.
But Herath finished with figures of 3 for 38, which included the key wickets of Cremer and Sean Williams, and Perera took 3 for 34 as Zimbabwe were bowled out for 186 with just 7.3 overs left in the game.
A rollercoaster of a final day began with Zimbabwe making a strong start to their innings, as openers Tino Mawoyo and Brian Chari saw off the new ball.
Even after Chari was bowled in Lahiru Kumara?s first over to depart for 10, Mawoyo found solid support from Hamilton Masakadza as the pair batted for almost an hour.
However a poor umpiring decision changed the complexion of the game, as Mawoyo was given out lbw to Perera by umpire Simon Fry, with replays showing that the ball was comfortably missing leg stump.
The DRS review system was not used in this match although will be operating in the second Test in Harare from Sunday.
Mawoyo?s departure for 37 sparked a heavy collapse, as Zimbabwe fell from 68 for one to 74 for five in the space of four overs.
?We were really happy with the start we had, but then when we started to lose a few wickets we panicked,? said Cremer.
Perera trapped Craig Ervine lbw in his next over, and in the following over Lakmal dismissed both Masakadza, for 20, and Malcolm Waller.
With another decision going against Zimbabwe after lunch, when Peter Moor was given out lbw by umpire Ian Gould to a Kumara delivery that was bouncing over the stumps, the end was in sight for the hosts.
But Williams was joined by Cremer, whose unbeaten century headlined the Zimbabwe first innings, and the pair saw the hosts through the next 80 minutes to the tea interval.
Needing four wickets in the final session to wrap the game up, Herath stepped forward to have Williams caught at slip for 40 before trapping Donald Tiripano lbw.
Yet Cremer fought on, taking his innings towards the three-hour mark and his score to 43.
With less than 10 overs to go, the Zimbabwe captain had a rush of blood to the head and was stumped off the bowling of Herath.
?I blame myself for losing this game,? said the man of the match. ?If I was there then at least if Carl (Mumba) or Chris (Mpofu) had got out then I would have felt a lot better about myself, but I think my wicket was the turning point in us losing this game.?
Mumba and Mpofu lasted a further three overs, before Perera sealed the game by bowling the latter for a duck, consigning Zimbabwe to defeat in their 100th Test.
?I tell you a lot of credit goes to the fast bowlers,? said Herath. ?There was not much assistance for the spinners and the Zimbabweans batted well. But the fast bowlers played their heart out and gave 100%.?