Bangladesh drew the one-day international series with Sri Lanka 1-1 after Nasir Hossain hit four boundaries in the next-to-last over Thursday to lead the visitors to a three-wicket win in the rain-affected third match.
Chasing a revised target of 183 in 27 overs under the Duckworth/Lewis method, Bangladesh was 167-2 with two overs remaining when Hossain took on seamer Thisara Perera to complete his team's first win in Sri Lanka.
Hossain remained unbeaten on 33 with six boundaries in 27 deliveries. Opener Anamul Haque top-scored with 40.
After a strong start of 77 between Haque and Mohammad Ashraful (29), Bangladesh lost 6-70 to be in a precarious position before Hossain came to the rescue.
Offspinner Sachithra Senanayake and seamers Lasith Malinga and Angelo Mathews took two wickets each for Sri Lanka.
"It's a huge win for us, it was a challenge for us to do well against big teams, so very happy with the effort," Bangladesh captain Mushfiqur Rahim said.
Sri Lanka captain Mathews said he is disappointed with the loss despite having a strong total on the board.
"The bowling let us down today," he said. "We batted brilliantly even though we lost out way in the middle."
Sri Lanka totaled 302-9 with Tillakaratne Dilshan hitting his 16th one-day century and second in the series.
Dilshan cracked 12 boundaries to score 125 off 128 deliveries and shared a 116-run opening partnership with Kushal Perera, who made 56, to lay a solid foundation.
Dilshan made an unbeaten 113 in the first match.
Perera's maiden international half-century included a six and five boundaries.
Left-arm spinner Abdur Razzak led Bangladesh's fightback as the hosts lost 5-35 halfway through their innings. Razzak finished with 5-62 from 10 overs, becoming the first Bangladeshi to 200 ODI wickets.
Offspinner Mahmudullah made the breakthrough for the tourists when he induced Perera to cut straight to a leaping Hossain at point.
Kumar Sangakkara and Dilshan put on 87 for the second wicket. Sangakkara made 48 with five boundaries before being caught by Haque for Razzak's first wicket.
Sangakkara's dismissal triggered a collapse in which the hosts lost their last seven wickets for 84.
Sri Lanka won the first match by eight wickets and the second match was abandoned because of rain.