The host nation led through a superb 55th minute strike from Siphwe Tshabalala. The midfielder collected the ball on the left of MexicoÃ¢â‚¬â„¢s box, steadied himself and promptly fired a ferocious left footed drive across Perez into the top corner.
It triggered a tremendous eruption of noise amongst the 84,000 partisan supporters.
But the South African audience’s celebrations were soon interrupted by MexicoÃ¢â‚¬â„¢s Rafael Marquez. The Barcelona defender escaped the attentions of the Bafana Bafana defence and stroked the ball calmly past Khune.
It was a fitting end to a closely-fought match with both sides surrendering chances to claim a vital three points.
Mexico started strongly in the first half and manufactured a number of early opportunities from set pieces. West HamÃ¢â‚¬â„¢s Guillermo Franco headed over from a Giovani corner with the South African keeper Khune stranded.
The contentious talking point of the first half was Carlos VelaÃ¢â‚¬â„¢s disallowed goal.
GiovaniÃ¢â‚¬â„¢s shot was deflected wide for a corner and from the resulting set piece, Franco headed the ball towards goal with ArsenalÃ¢â‚¬â„¢s Vela deflecting the attempt into the net.
The assistant immediately raised his flag, and replays showed the officialÃ¢â‚¬â„¢s decision to have been correct by the narrowest of margins.
South Africa emerged from the break a more assured side, boasting longer spells of possession. Mexico probed the home nation’s defence but failed to penetrate the unstable back-line. The host nation appeared content to hit their opponents on the counter attack.
In the dying moments the stadium rose to its feet with at the sight of South Africa striker Katlego Mphela bounding clean through on goal.
The fairytale ending was in sight but Perez’s left post denied Mphela and South Africa a memorable climax to an enthralling game.
MORE: Man United latest news
MORE: Arsenal latest news
MORE: Chelsea latest news
MORE: Liverpool latest news