The Matildas suffered a surprise loss to Italy in their opening game and their campaign looked in serious trouble when they trailed to a Marta penalty and Cristiane's fourth strike in two matches.
But the Matildas levelled through Caitlin Foord's poked finish and Chloe Logarzo's cross-shot either side of half-time, with Marta needing to be withdrawn with a knock at the interval, having earlier extended her record tally to 16 World Cup goals.
Defender Monica's unfortunate own goal - which was eventually awarded by VAR, with an offside Sam Kerr controversially judged not to have been interfering - completed Australia's remarkable comeback.
The Australians, who are ranked sixth in the world, are now level with Brazil and the Italians on three points in Group C, before Jamaica and Italy meet in their second match in Reims on Friday, in the most evenly poised group at the tournament.
Brazil, who beat Jamaica last time out through a memorable Cristiane hat-trick, had not lost a group stage match at the finals since 1995.
And the 2007 runners-up appeared to be in full control of Thursday's thriller in Montpellier upon entering first-half stoppage time, before Foord's close-range finish gave Australia hope.
Marta, who missed Brazil's first game through injury, arrived in France with a one-goal lead in the Women's World Cup goal standings over former Germany star Birgit Prinz and ex-USA forward Abby Wambach, who both retired with 14 goals at the finals.
And the Orlando Pride star's 16th saw her become Brazil's record scorer at senior World Cups as she surpassed iconic former Real Madrid forward Ronaldo's 15, while moving level with Germany's Miroslav Klose at the top of the standings.
She coolly converted from the spot after Australia's Elise Kellond-Knight had dragged back Leticia Santos in the box, before Cristiane's fine leap and header into the corner made it 2-0.
At that stage, the Brazilians were almost unrecognisable from the disappointing team that finished bottom of this year's invitational SheBelieves Cup in the United States in March.