Bangladesh went from looking like losing by an innings to beating West Indies on a compelling day three of the first Test.
A brilliant rearguard stand by captain Shakib Al Hasan and Nurul Hasan on Saturday saved Bangladesh from an innings defeat.
But when it was all out for 245 runs, it left West Indies only 84 to win with more than two days left at Sir Vivian Richards Stadium.
The target suddenly looked like 840, though, when Bangladesh medium-pacer Khaled Ahmed took three wickets in 11 balls and reduced West Indies to 9-3 in the fourth over of the chase.
Opener John Campbell and Jermaine Blackwood eased the tension by holding out to stumps and leading West Indies to 49-3. The team should knock off the remaining 35 runs on Sunday morning in the series opener.
Ahmed gave West Indies a good scare.
He had West Indies captain Kraigg Brathwaite caught down the leg side for 1 from his first delivery, and Raymon Reifer gloving his fifth delivery on 2. Nkrumah Bonner hadn't scored when his off stump was bowled by Ahmed.
Campbell, 28 not out, and Blackwood, 17 not out, combined for 40 to get the home side back on track.
West Indies seemed in the morning like it was going to wrap up the match by mid-afternoon.
Bangladesh was reeling at 109-6 in the second innings and still trailing West Indies by 53 runs when Shakib and Nurul came together in the morning.
But showing the patience most of their teammates didn't on a good batting track, they rubbed out the first-innings deficit through a wicketless middle session, and pushed Bangladesh 70 runs ahead when they were broken up soon after tea.
With the new ball, West Indies pacer Kemar Roach made Shakib drive straight to a man at short extra cover.
Shakib was out for 63, his third straight Test half-century and second of the match. His demise ended a 123-run stand with Nurul.
They seemed to match each other run for run, as Nurul was on 60 at the time. He was out for 64 after 147 balls, also bagged by Roach.
Bangladesh started the day on 50-2 and got into deeper trouble with poor shots to regulation deliveries.
Najmul Hossain Shanto went from 8 overnight to guiding Kyle Mayers to the slips on 17, then Mominul Haque was leg before to Mayers and not saved by a review. Mominul's score of 4 was his ninth straight Test score in single figures, and his 10th of 11 this year.
Liton Das was caught by Mayers in the slips, and Mahmudul Hasan Joy's stoic 42 that started late Friday ended four overs from lunch when he was caught behind off Roach, going for a wide ball he should have left alone. He'd endured 153 balls.
Shakib and Nurul dug in and West Indies wasted its last two reviews after lunch trying to get them out. Ultimately, it had to wait for the new ball, and Roach delivered.
Roach conceded the only six of the Bangladesh second innings when Mustafizur Rahman blasted him over the third man boundary, but Roach had the last say by ending the innings by bowling Ebadot Hossain.
That gave Roach his 10th Test five-for (5-53), and tied him with Michael Holding on the West Indies wicket-taking list: 249 and sixth place.
Alzarri Joseph took 3-55 and Mayers 2-30.