The hosts have made the Cup quarter-finals for the last 15 home events but needed to beat South Africa by five points to guarantee qualification for the knockout stages.
Australia went into overtime leading 24-21 and conceded a penalty with South Africa looking to win themselves. But Australia forced a turnover and broke three-on-one, with Malouf powering to the try line 90 seconds past the hooter.
They had led 17-0 through Jeral Skelton and Lewis Holland’s double but South Africa produced a sucker punch either side of the break, with Justin Geduld’s pair of tries and Stedman Gans putting the Blitzboks ahead.
Geduld was carded for a deliberate knock-on and Australia capitalised through Josh Coward before the late drama.
It means Australia can still retain their HSBC Sydney Sevens title, but finishing second has handed them a tricky draw against Fiji, the winners in Cape Town and Hamilton.
The winner of that tie will play either New Zealand or France. The other Cup quarter-finals see South Africa play England and USA take on Spain.
Fiji beat Samoa in the final game of the day to confirm their position as Pool A winners. They were pegged back twice in the first half but dominated possession in the second to win 22-12.
Alasio Naduva scored arguably one of the tries of the series as Fiji cruised past Japan with a 34-5 victory. They led 17-5 when the 28-year-old chased a restart, managing to reach the ball just before it dropped out of play to dot down.
England lost 14-7 to Fiji after a nail-biting second half, which saw England reduced to six players and a dangerous Dan Norton offload not collected by Dan Bibby. They put four tries past Samoa and six past Japan to finish second in the pool.
Japan won a thriller against Samoa, with Dai Ozawa giving them a four-point lead going into the final seconds. Samoa earned a penalty with 15 seconds to go but as the siren went, the ball was knocked on to hand Japan the 21-17 victory.
USA finished top of Pool B having conceded their first points in their final game of the day. They led 22-0 against Canada before Connor Braid grounded a try, but hat-tricks from Carlin Isles — who reached 150 tries on the HSBC World Rugby Sevens Series — and Kevon Williams ensured there would be no comeback.
USA had to fight for a 7-0 win over France in their opening match but were far more free-flowing as the day went on, with seven different players running in tries against Kenya.
France finished second in the pool to reach the quarter-finals for the first time since Cape Town in 2017. They recovered from defeat to USA by coming from behind to beat Canada, with Thibaud Mazzoleni’s pair of tries in the final five minutes enough.
Les Bleus followed that up by cruising past Kenya, with Stephen Parez scoring four tries in 11 minutes and setting up another.
New Zealand claimed three wins from three to top Pool C, although it wasn’t entirely smooth sailing. They had survived a scare against Wales, first slipping behind thanks to Owen Jenkins’ try and being pegged back late on through Ben Roach. In between times, Kurt Baker assisted and scored a try before Regan Ware and Sione Molia confirmed the result.
But the All Blacks Sevens ran in 41 points against Spain and 42 points against Scotland, racking up 13 tries across the two matches.
Second place in the pool went to Spain, who began the day by coming from behind late against Scotland thanks to tries from Alejandro Alonso and Inaki Mateu.
An impressive performance against Wales saw Pol Pla run in two tries with Alonso adding to his earlier score in a 21-5 victory.
Argentina produced the shock of the day with an imperious 29-14 victory over hosts Australia, but the Pumas Sevens fell just short of reaching the quarter-finals.
Simon Kennewell gave Australia a lead after they had gone behind early, but tries from Lucio Constantino Cinti Luna, Rodrigo Etchart’s double and Gaston Revol’s drop goal took Argentina beyond reach.
It took a second-half resurgence for Argentina to beat Tonga, twice going behind before the break. But Franco Sabato scored his 100th and 101st series tries in a minute after the break with Rodrigo Etchart — who had earlier reached his 50th try — adding to the score.
Tonga face the prospect of having just 10 players for the Challenge Trophy after Tali Finau and Otu Mausia were sent off for contact with the head against Australia and Argentina respectively.
Australia had dominated against Tonga with Lachie Anderson and Lewis Holland running in two tries each, with captain Holland also reaching his 100th try on the series.
South Africa had to come from behind to beat Argentina, trailing initially from Renzo Barbier’s try before a Siviwe Soyizwapi double and Selvyn Davids’ score put the Blitzboks in command.
Pairs of tries for Werner Kok, Soyizwapi and Gans helped South Africa see off Tonga.