Louis Oosthuizen recovered from an awful drive on the 18th to hold his nerve and claim the Alfred Dunhill Championship with a fantastic 20-foot putt.