The home team started the final day of the contest on 170/3, still requiring another 218 runs to win with Kusal Mendis (60 not out) and Angelo Mathews (17 not out) at the crease.
Mendis though was out early on the fifth morning to Zimbabwe captain Graeme Cremer, only adding six runs to his overnight total as the visitors made the perfect start.
Cremer then got Mathews, for 25, the leg-spinner taking a good low caught and bowled chance as Sri Lanka slipped to 203/5.
Niroshan Dickwella and Asela Gunaratne then combined for a vital match-winning partnership in the middle-order as the pair added 121 for the sixth wicket.
Dickwella though was out when was caught by keeper Regis Chakabva for an enterprising 81 but Gunaratne was unmoved at the other end.
Although there were a few nervous moments with balls just falling short of fielders and half-chances spurned by the visitors, the home team got over the line just before tea with Gunaratne (80 not out) supported by Dilruwan Perera (25 not out).
As well being Sri Lanka’s highest successful run-chase in Test cricket, it was also the highest score chased in the longest format in Asia and the fifth highest run-chase in Test history.
Zimbabwe had batted first and posted a total of 356 all out thanks to an monumental knock of 160 from Craig Ervine with Sri Lanka replying with 346, Cremer taking five wickets.
The African side then staged a remarkable turnaround in their second dig at the crease, recovering from 59/5 to score 377 thanks largely to a maiden ton from Sikandar Raza while Sri Lanka’s veteran left-arm spinner Rangana Herath completed 11 wickets in the match.