Thomas held an overnight lead of 1min 39sec on compatriot Froome, but took it to 2:31 after the four-time champion crossed the finish 1:36 behind Quintana and nearly a minute off Thomas.
Ireland's Dan Martin (UAE) finished second at 28secs behind Quintana, with Thomas third at 47 and Slovenian Primoz Roglic (Lotto-Jumbo) in fourth at 52.
Froome's failure to stay with Thomas in the final few kilometres of the 16 km climb to the finish of the Col du Portet amid a series of attacks by rivals means the Kenyan-born Briton is in danger of finishing off the podium.
Dutch rival Tom Dumoulin, the 2017 Giro d'Italia champion, has now moved up to second place with Roglic up to fourth overall, just 16secs behind Froome.
Welshman Thomas will start Thursday's 18th stage, a mainly flat 171 km ride from Trie-sur-Blaise to Pau with a 1:59 lead on Sunweb team leader Dumoulin, with Froome in third.
"It's unfortunate Froomey lost time. But he's still up there in the podium (position)," said Thomas, who is taking nothing for granted yet.
"I'm feeling good, but I'm not going to get carried away. I will keep refuelling, eating and drinking as best I can and not let any complacency creep in."
Froome appeared to abdicate his crown when he tipped his hat to Thomas at the finish.
“I've won the last three Grand Tours I've done now... but I'm still going to try and fight for the podium and try and obviously keep G up there in yellow," he said.
Quintana said: "I'm happy for the win. It was a day for the pure climbers.
"It's also great for the morale of the team. It's been frustrating, and sad because things didn't work out the way we'd hoped.
"But we have to keep on fighting."