This was the fourth highest run chase in T20 Internationals and Bangladesh's best.
Mahmudullah got Mendis out with his off-spin as he struck twice in his very first over to check Sri Lanka's surge.
Mendis (57) shared a 56 run stand with Danushka Gunathilaka (26) before putting on 85 for the second wicket with Perera.
Captain Dinesh Chandimal followed soon after as Sabbir Rahman completed a third catch.
Mustafizur Rahman was expensive, conceding 48 runs off his four overs, but picked up three wickets while skipper Mahmudulla had two scalps for 15 runs.
The wicketkepper-batsman was clearly in pain by the latter stages of his innings, but that did not deter him in scoring a 35-ball 72 that featured four crucial sixes and five boundaries which saw Bangladesh overcome the highest total ever posted against them by Sri Lanka.
Further, sending a left-right combination by promoting Liton Das up the order helped men-in-green. Soumya Sarkar, who batted before Rahim struggled a bit as he was able to contribute run a ball 22 runs.
Pressure mounted on the Tigers when they lost the other opener Tamim Iqbal (47 off 30) halfway through the huge chase.
Mushfiqur took the winning run in the last over with two balls to spare.
"It was a great game of cricket". However, with the extra moisture, we might see things change and there could be some extra assistance and juice for the bowlers.
They needed 112 at the back 10 at little over 12 runs an over. The Kusals are in good form and it really gives the batting unit confidence.
The first over set the tone for the innings.
"I think we are just one win away from getting a boost". Then Mushy was outstanding.
Mushfiqur hit a full-toss from Pradeep towards mid-wicket to reduce the asking rate to nine off the last over from which, he collected six runs in the first two deliveries of medium-pacer Thirsara Perera to help Bangladesh end their five-match losing streak in T20I. Credit goes to the batsmen for holding their nerve. "I was just having a cramp, and hopefully I will recover for the next match".