The World XV managed to cross the Springboks' line twice, giving hope to Frank Hadden and his team, who arrive on Monday for a two-Test series against South Africa.
Matthew Burke opened the scoring with a fifth-minute penalty, matched by Montgomery two minutes later before the World XV took the lead for the first time in the game.
Having forced a five-metre scrum, Sebastien Chabal peeled away from the back and fed the ball to Justin Marshall, who fell over for the first try.
Montgomery added three more penalties to one from Burke, before Du Toit ended the half with his big kick for a 15-11 lead.
The World XV were the first to strike in the second half after Bok loose forward AJ Venter was yellow-carded for a punch seen by touch-judge JC Fortuin.
Carlos Spencer sent a perfectly-weighted cross-kick for Fiji international Isa Nacewa to grapple out of the air.
Montgomery initially went for Nacewa, but realising he was in the air left him, and thus gave him the split second he needed when he landed to get away from the full-back and run around the posts to score.
Despite being down to 14 men, the Boks kept on forcing penalties, much to the heated frustration of the World XV, and Montgomery kept on plugging them home.
Three more penalties took the Boks to 24-18, while Burke brought it back to 24-24.
And, as the game drew to a close, another pair of penalties left the scores locked at 27-27.
But the World XV were pinned for being offside in their own 22, and Montgomery had the easiest of kicks to the posts to secure the victory for Jake White and keep his personal record of never having lost an international on home soil.