Thomas shot free with Adam Yates (Mitchelton-Scott), Richie Porte (BMC Racing) and Daniel Martin (UAE-Team Emirates) on the steep climb of two kilometres. He eased off the gas, but still gained time on his rivals. That added to a two-second time bonus he gained ahead of the final kilometres.
Martin won the stage ahead of Pierre Latour (Ag2r La Mondiale) and Thomas finished ninth in a group five seconds ahead of his team-mate Chris Froome.
"Letour went quite early, and same thing, he was strong and stayed away," Thomas explained. "I thought, if I can still get third, I can get a bonus and maybe take the jersey. But when Valverde kicked, I knew I wasn't going to get around him. So I stayed on the wheel and saved that one per cent maybe for another day."
Thomas's gains puts him in second overall and back at three seconds from the race leader Greg Van Avermaet (BMC Racing). Froome sits 14th at 1-02 minutes.
He gained two seconds at the bonus-second sprint, placing second behind Jack Bauer (Mitchelton-Scott) who broke aawy late in the stage.
"It was just how it was on the road. It didn't look like anyone was going for it, and there were still two seconds out there on the road, so I just picked them up while I could. I don't think that they'll let me do that again, not a third time lucky.
"I thought, why not? You never know what will happen in the finish and you might take the jersey."
Near the finish, Thomas eased off. Some speculated that Team Sky directors may have told him to ease off and not gap four-time Tour winner Froome.
"When I saw everyone sat on me, I thought, I'm not going to drag everyone up," Thomas said to the assumption. "So I swung over and let someone else do it."
"The guys were trying to set me up to stay even on time and set up Geraint to get bonuses and maybe the yellow jersey – it's a shame that we didn't do either one of those things [laughs]," Froome added.
"I lost a bit of time, but it was very explosive there in the end. It's only a bit of time and there is still a long way to go in this Tour."
The Tour continues with flat stages this week, but that includes the feared Paris-Roubaix stage on Sunday. It covers 21.7 kilometres of cobbles to finish in Roubaix, the sight where the French one-day Monument closes every April. The first week ends there in the industrial former coal-mining town.
"It's one of those weeks," Thomas said. "A lot is happening. I am sure it is not over yet, especially come Sunday. It'll be action packed.
"The Roubaix stage? It's just more trying to ride like we have been all week, stay at the front, stay out of trouble. And try to take any opportunity. It's going to be a crazy, crazy day."
Thank you for reading 20 articles this month* Join now for unlimited access
Enjoy your first month for just £1 / $1 / €1
*Read 5 free articles per month without a subscription
Join now for unlimited access
Try first month for just £1 / $1 / €1