South Africa beat New Zealand 17-12 in the final of the rugby sevens at Ibrox Stadium to end the All Blacks' 30-match unbeaten run at the Commonwealth Games.
New Zealand had won gold at every Games since the sport made its debut in 1998.
But the Springboks had too much pace and class for the defending champions, outscoring them by three tries to two.
Australia beat Samoa 24-0 to win the bronze medal, while Scotland, England and Wales all failed to progress beyond the quarter-finals.
With the sport making its Olympic debut in Rio in 2016, the tournament in Glasgow was always going to be about more than the action on the pitch.
And with International Olympic Committee bigwigs and Rio's organising officials no doubt paying close attention, sevens did not disappoint, packing out a 50,000 capacity stadium on both days and providing a carnival atmosphere.
There were mass singalongs, there was 'kiss-cam', there was Gangnam Style dancing on an industrial scale.
There was even an on-pitch proposal, as well as some compelling stories provided by some of the less-established rugby nations.
The side which was expected to lift the trophy after the party had stopped were the All Blacks, winner of 12 IRB World Series titles and two World Cups.
However, a South Africa side full of searing pace and no little skill trumped them in the final, even managing to match the All Blacks physically.
Sherwin Stowers scored New Zealand's first try after a cute pass from his captain DJ Forbes.
But the Springboks were giving as good as they got, especially after Bryce Heem was yellow-carded for kicking the ball away.
Seabelo Senatla went over for his 10th and 11th tries of the tournament on either side of half-time to give South Africa a 12-7 lead, before Cecil Afrika raced in from the halfway line to extend the Springboks' lead to 10 points.
Joe Webber hit back with a close-range try after a screaming break by Declan O'Donnell but when Akira Ioane knocked the ball on with seconds remaining, the game was up for New Zealand.
The hosts, who came close to beating defending champions New Zealand in their pool on Saturday, lost 35-12 to South Africa in the last eight.
Two tries either side of the break, from Mark Bennett and Lee Jones, gave the home faithful hope, but the Springboks finished with five tries in all.
Wales blitzed Australia in the first half of their quarter-final, opening up a 19-0 lead through tries from William Harries, Lee Williams and Luke Morgan.
But tries from Wallabies skipper Ed Jenkins and Sean McMahon reduced the deficit to five points before Pama Fou went over for a try with the last move of the match.
Clark Cameron knocked over the conversion to secure a 21-19 win.
England were under intense pressure for the first five minutes of their quarter-final against Samoa. But when Marcus Watson scored a breakaway try, it looked like England might take a lead into the break.
However, Samoa Toloa scored two tries just before half-time, taking his tournament tally to seven. Worse for England, James Rodwell was sent to the sin-bin for a cheap shot on Toloa as he slid in for his first score.
Lio Lolo produced an acrobatic finish in the corner to increase Samoa's lead, and a moment of magic from Daniel Norton, who kicked diagonally on the run before touching down under the posts, was too little, too late for England, who lost 15-14.
The All Blacks saw off Kenya 19-7 in their quarter-final, setting up a semi-final against Australia. The Wallabies were level at half-time but Scott Curry scored two tries after the break to secure another 19-7 victory for the Kiwis.
Meanwhile, South Africa had too much class for Samoa in their last-four encounter, with man-of-the-tournament contender Cornal Hendricks scoring two of the Springboks' five tries.
England beat Scotland 15-12 in the semi-finals of the Plate Competition, setting up a final against Wales, who beat Kenya 28-5. In the fifth-place decider, England's Philip Burgess secured victory over Wales with a last-gasp try.
Canada beat Cook Islands 50-7 in the final of the Bowl Competition, so sealing ninth place, while Sri Lanka beat Trinidad and Tobago 43-7 in the final of the third-tier Shield Competition.