After scoring a competitive 243-7, Bangladesh XI bowlers denied the visitors the winning run by claiming two wickets in the final over.
The South Africans needed just five runs in the final over but unheralded paceman Rubel Hossain bowled Johan Botha (34) off the penultimate ball while Albie Morkel (58) was run out off the last ball.
The tied result meant Bangladesh would go into the three-match one-day series starting here on Sunday with some of their confidence restored.
Morkel had almost earned his side the victory with his 53-ball knock that contained two fours and three sixes after Graeme Smith laid the platform for the chase with an 83-ball 70 inclusive of nine fours and a six.
But some inspired effort by the hosts ensured there were smiles all around the Bangladeshi camp, reeling after a 2-0 whitewash in the preceding Test series.
Morkel, who is being tried in the all-rounder's spot in the absence of the retired Shaun Pollock, did not disappoint although he would rue the chance to finish the game off.
Earlier, an entertaining 44-run partnership off 29 balls between tailenders Mahmudullah Riyad and Farhad Reza was the highlight of the Bangladeshi innings.
Riyad hit two fours and a six off Dale Steyn in his cameo 37-run knock while Reza hit two fours in a 15-ball 20.
Steyn, who tormented the hosts during the Test series, looked off-colour, giving away 38 runs off six overs with one wicket.
Left-arm spinner Paul Harris, getting his first look-in on the tour, was the pick of the South African bowlers with figures of 2-30 off eight overs.
The second and third one-dayers will be played in Dhaka on Wednesday and Friday.