The visitors lost the opening two matches but raced to 126-3 in 14 overs after bowling out their hosts for 124 in Chittagong.
Shamim Hossain struck his maiden 50 to lift Bangladesh from a precarious 41-5 but it was not enough to deny Ireland their first win of the tour.
Stirling hit 10 fours and four sixes, including a six and three fours off consecutive deliveries, to hasten his team’s victory.
Taskin Ahmed bowled Ross Adair for seven before Shoriful Islam dismissed Lorcan Tucker for four, but Stirling shared a 68-run partnership with Harry Tector for the third wicket to keep Ireland on course.
Ireland were well in control by the time debutant leg-spinner Rishad Hossain had Stirling caught by Najmul Hossain at long on.
Curtis Campher sealed the win with a six off Taskin.
Mark Adair led Ireland’s bowling attack with 3-25, while Matthew Humphreys picked up 2-10, denying Bangladesh the opportunity to build any significant partnerships.
Adair dismissed the in-form Litton Das for five off his first ball in the second over.
Shamim, who came at number six, hit five fours and two sixes to take Bangladesh past the 100-run mark before he became the last man dismissed.
Bangladesh won the preceding one-day international series 2-0. The two teams will now play a one-off Test starting on Tuesday in Dhaka.