Matt Renshaw showed great fight to be there at the end, not out on 34 off 137 balls.
David Warner fell three runs short of a half-century when he was run out after a mix-up with Renshaw.
Warner miscued a swat to the leg side off spinner Shamsi and called his partner through for a quick single. Renshaw was slow off the mark, took a couple of steps, then hesitated and sent Warner back.
The left-hander never had any hope of making it back safely and was out by half the length of the pitch.
Had Renshaw responded straight away, he may have made it to the other end, although Shane Warne didn't think there was ever a run in it, saying "there definitely wasn't a run there" in his commentary.
Renshaw was a tad late to send the Australian vice-captain back and the hosts lost their first wicket.
Earlier, after a whopping 234 balls at the crease, Stephen Cook brought up his century with a pull shot towards square leg.
Cook has easily been the pick of the South African batsmen after surviving Saturday night's onslaught and pushing through two new balls.