It left Jeet Raval and captain Kane Williamson cautiously to get the run chase back on track for New Zealand who went to tea at 59 for one.
Raval was on 26 and Williamson 21 with Latham dismissed by Vern Philander in the sixth over for 10.
Williamson had a narrow escape three overs before the break when an edge off Keshav Maharaj fell just short of Hashim Amla at first slip.
Philander was the most effective of the South African bowlers with one for 11 off six overs on a wicket New Zealand were able to exploit earlier in the day.
After South Africa resumed at 229 for four they advanced to 252 before Neil Wagner captured the key wicket of Dean Elgar for his best Test score of 140 and the last six wickets fell for 56 runs.
Taking the catch was a small consolation for the New Zealand wicketkeeper who had dropped Elgar on day one when he was on 36.
Trent Boult, who returned figures of four for 64, dismissed Temba Bavuma for 64 and ended the South Africa innings when he bowled Philander in the fifth over after lunch for 21.
Wagner took three for 88 and Jeetan Patel finished with two for 85, including the prized wicket of Quinton de Kock for the third consecutive innings on this tour.
Disclaimer: No Business Standard Journalist was involved in creation of this content
