Two key wickets in the last two overs of the opening day allowed Bangladesh to claw their way back into the first Test with New Zealand.
At 276-3 the Black Caps were moving serenely towards the close in Chittagong but when the bails were flicked they had been reduced to 280-5.
Centurion Kane Williamson was the first to go, departing for 114, before captain Brendon McCullum was dismissed with what proved to be the final ball of the day.
It was a messy end to the day for the tourists, although before that Williamson had batted brilliantly for his fourth Test hundred.
The Yorkshire batsman needed 175 balls to reach the milestone, but had to depart before the end when he was pinned leg before by Shakib Al Hasan.
McCullum quickly followed him, playing across the line to Abdur Razzak (2-100) and leaving his team-mates with a bit of work to do on Thursday.
Earlier in the day Williamson and Peter Fulton had shared a 126-run stand for the second wicket to set New Zealand up.
After Greg Rutherford was caught at mid-on off the bowling of Sohag Gazi for 34, the duo set about putting their side in control.
Fulton would eventually go for 73, caught at cover off Nasir Hossain, with Ross Taylor the other wicket to fall, also caught at cover off Razzak.
McCullum had won the toss for the first of the two-Test series, choosing to bat. He also handed debuts to Corey Anderson and Ish Sodhi, with the former having made his ODI debut against England this summer and the latter a newcomer to world cricket.