Lolesio had an attempted dropped goal blocked, but calmly slotted a penalty shot seconds later from directly in front to seal it.
Asked if he'd ever won a test from a similar position, Wallabies captain Michael Hooper said: "Not when you think it's all but done. Happy to be on the right side of it, though.
"Very proud of the guys to keep fighting there right to the death."
France coach Fabien Galthie praised his team's strong start but conceded that inexperience cost them in the end.
"There's lots of strong emotion — we need to be able to get rid of a lot of those emotions," he said. "We need to shift what just happened and focus on next week."
The second match is in Melbourne next Tuesday.
The French squad was missing a host of stars and went into the match on limited practice after spending two weeks in strict quarantine because of Australia's COVID-19 protocols, yet it was the Australians who lacked cohesion in their first test of the 2021 season.
The scrappy encounter was played in front of 17,821 fans, with a crowd allowed into Suncorp Stadium four days after Brisbane finished a snap four-day lockdown.
Villiere scored the opener in the 6th minute with an angled run from the left wing after the French won a scrum against the head.
He sprinted 25 meters untouched for his second after the French won a scrum following an Australian error, shifted the ball to the midfield and Jonathan Danty fed him a quick inside ball in a yawning gap.
Australia reduced the margin to 15-7 at the break when hooker Brandon Paenga-Amosa barged over in a driving maul.
Louis Carbonel and Melvyn Jaminet kicked second-half penalties for France and Lolesio added one. The French led 21-13 with 10 minutes to go.
Hooper drove over from close range and Lolesio converted to make it 21-20 with less than 10 minutes left, but squandered chances appeared likely to be costly for Australia until the very end.
Australian center Hunter Paisami, who had a try disallowed in the first half for a forward pass, created a chance with a grubber kick into the in-goal in the 55th minute that Tom Wright knocked-on. His chip kick wide went out on the full late in the match when the safer option was to pass.
"We had a lot of opportunities late that we didn't nail," Australia coach Dave Rennie said. "Happy to get away with it in the end. There was a lot of character shown."
Fullback Jaminet, one of seven previously uncapped players in the French match-day squad, had mixed feelings about a test debut that went so close to victory.
"It's hard to accept because the end is cruel. Despite everything, this (debut) was incredible but the end still hurts the head," he said. "We missed a minute to have a perfect evening.
"We know we still have two games left ... so it's up to us to work well to come back in six days."