Portugal’s KTM rider Oliveira took the chequered flag ahead of Australia’s Jack Miller, with title contender Francesco Bagnaia of Italy third.
He is now just two points behind Yamaha’s Quartararo in the standings with three races left.
It was a nightmare day for France’s Quartararo and Spain’s Aleix Espargaro - third in the title chase - hardly had a great time either.
He came 11th on his Aprilia in the first MotoGP in Thailand since 2019 and is 20 points off Quartararo. The title race is too close to call.
Australia is up next, in two weeks, and Ducati’s Bagnaia smells his chance.
“It will be very important to be competitive but it won’t be easy,” the man with all the momentum said after closing the gap once more on Quartararo.
“It’s one of my favourite tracks. I feel we can do something good.”
The race was delayed for almost an hour because of heavy rain over the Buriram circuit and it played out in treacherous conditions.
“Every time we get a chance to ride on the wet I’m always super fast,” Oliveira said after upstaging the title contenders.
For Miller it was a second podium finish in a row, after his victory last weekend in Japan. He is fifth in the championship standings.
“I was pushing hard there, I didn’t give up on victory,” Miller said.
“It’s not an easy task in these conditions.”
Miller is due to get married next weekend, ahead of his home grand prix, and said he would have been in “trouble” if the race had been postponed.
Spanish six-time MotoGP world champion Marc Marquez - who has won twice previously in Thailand - showed he is back to near full fitness, placing fifth behind flying Frenchman Johann Zarco.
Italian rookie Marco Bezzecchi clinched his first MotoGP pole position on Saturday but could only manage a 16th placing.
In the Moto2 race, heavy rain initially cut the race down from 24 laps to 16 with commentators later likening the start and finish line to a lake.
There was no fairy tale finish for Thai hero Somkiat Chantra - who started the race in pole for the first time - crashing early in the torrential conditions after notching up a two-second lead.
At lap eight, race officials brought out the red flag.
Moves to restart with a five-lap dash were delayed with a second red flag as rain bucketed down.
Race officials were forced to cancel the restart and allocate half points because two-thirds of the race distance wasn’t reached - Italy’s Tony Arbolino was awarded the event.
Italian rider Dennis Foggia, on a Honda, won the Moto3 race from pole position - his fourth race win of the season.
MotoGP next moves to Australia’s Phillip Island before heading to Malaysia and wrapping up in Valencia, Spain.