Herath grabbed 4-15 as Pakistan, chasing a modest target of 168, collapsed from a seemingly impregnable 71-2 to 117 all out in their second innings before lunch on the fourth day.
Fast bowler Thilan Thushara and spinner Ajantha Mendis chipped in with two wickets each as a jittery Pakistan lost their last eight batsmen for 46 runs at the Galle International Stadium.
The brilliant win gave Sri Lanka a 1-0 lead in the three-Test series, the first between the two nations since gunmen attacked the Sri Lankan team bus in the Pakistani city of Lahore on March 3.
The attack injured seven Sri Lankan players and killed eight local security men, prompting the sport's governing body to move 2011 World Cup matches out of Pakistan.
Pakistan, who beat Sri Lanka in the World Twenty20 final in London last month, now have four days to ponder the loss before the second Test starts at the P. Sara Oval in Colombo on July 12.
Herath, who replaced the injured Muttiah Muralitharan for this match, struck