Opening batsman Tamim (57) fell in the second session while Mahmudullah (67) was out just before rain stopped play with Bangladesh on 179 for four, trailing South Africa by 69 runs.
Captain Mushfiqur Rahim (16) and all-rounder Shakib Al Hasan (one) were unbeaten for Bangladesh, who have lost all of their previous eight meetings against the world number one-ranked Test side.
Resuming the second day on 7-0 after bundling South Africa out for 248, Bangladesh lost two wickets in quick succession and were forced to consolidate against a probing attack.
Imrul Kayes (26) and Tamim did well to see off the opening burst from the South African fast bowlers to take their team to 46-0 before an innocuous delivery from part-time medium pacer Stiaan van Zyl brought the first breakthrough.
Kayes lost his balance against a delivery down the leg side and wicketkeeper Quinton de Kock completed a smart stumping.
Number three batsman Mominul Haque (six) fell three overs later when he was bowled after missing an arm-ball from off-spinner Simon Harmer to leave the hosts floundering at 55-2.
Tamim and Mahmudullah, however, pegged the tourists back with a watchful third-wicket stand of 89 that ended when the former was bowled out by part-time spinner Dean Elgar.
Bangladesh staved off the pace trio of Dale Steyn Morne Morkel and Vernon Philander for most of the day but it was the latter who dismissed Mahmudullah near the close to somewhat spoil an otherwise satisfying day for the hosts.
Heavy rain forced the players off four balls after Philander struck and, though there was a restart, only one ball was bowled before another downpour washed out 25 overs of the day's play.
Scorecard
South Africa 1st innings: 248 all out
Bangladesh first innings (7-0 overnight):
Tamim Iqbal b Elgar 57
Imrul Kayes st de Kock b van Zyl 26
Mominul Haque v Harmer 6
Mahmudullah lbw b Philander 67
Mushfiqur Rahim not out 16
Shakib Al Hasan not out 1
Extras (lb 5, nb1) 6
Total (for four wickets; 67 overs) 179
Fall of wickets: 1-46, 2-55, 3-144, 4-178.
Bowling: Steyn 13-3-46-0, Philander 12-1-22-1, Morkel 11-2-28-0, Harmer 19-3-59-1, van Zyl 9-2-13-1, Elgar 3-0-6-1.
Image: Tamim Iqbal
Photograph: Andrew Biraj/Reuters