Chris Greaves produced an instrumental performance to help Scotland deal an early dent to Bangladesh's hopes of progressing to the T20 World Cup Super 12 with a shock win.
A Scotland victory appeared extremely unlikely when they were reduced to 53-6 having been put into bat in Muscat.
However, Greaves' 28-ball 45 helped Scotland rebuild their innings, as they reached 140-9, in an innings that saw Shakib Al Hasan become the leading wicket-taker in T20 internationals, with two dismissals taking him to 108.
And Greaves was similarly key with ball in hand, his 2-19 comprising the key wickets of Shakib and Mushfiqur Rahim.
Greaves broke up that duo's 47-run third-wicket partnership by removing Shakib for 20 and then benefited as Mushfiqur misjudged a scoop on 38 and lost his leg stump.
Brad Wheal (3-24) took a starring role from there, dismissing Nural Hasan (2) and Bangladesh captain Mahmudullah (23) in the space of four 19th-over deliveries.
Bangladesh were left needing 24 off the last over and that proved too steep a challenge as Scotland prevailed by six runs.
The day's earlier Group B game saw Oman cruise to a 10-wicket win over Papua New Guinea thanks in part to Jatinder Singh's 73.