If you are on SA from JNB-CPT, they have a Premium Class Lounge that you could use if you are in F or C on SA, or if you are Star Alliance Gold. So, if you buy one ticket LH F to JNB and SA C to CPT, you should have access to the SA lounge.
SAA Lounge Page
I should note that the SAA page doesn't seem to denote C access, but the StarAlliance lounge page does, so you may need to validate that. Others can probably confirm/deny this.