With temperatures surpassing 100 degrees for the third straight day, Chaves — riding for Orica-GreenEdge — completed the 99.4-mile leg from Santa Clarita to Mountain High Ski Resort in 4 hours 9 minutes 13 seconds.
Wiggins, the Sky rider who won the 2012 Tour de France, finished fifth in the most difficult stage of the eight-day race. He leads Australia's Rohan Dennis of Garmin-Sharp by 30 seconds.
American Lawson Craddock of Giant-Shimano was third overall, 1:48 behind Wiggins.
"The team rode incredibly to put me in that position today," said Wiggins, who took the race lead Monday after claiming the second stage individual time trial by 44 seconds.
Spain's David De La Cruz of NetApp-Endura was second in the stage that featured 11,700 feet of climbing, including a 17-mile finishing ascent with an average 6.3% gradient and to an elevation of 7,200 feet.
"Today was the day, not that you fear it, but the stage you wanted to get through," Wiggins said. "There's always a danger in a day like today with the heat and attacks coming in the final 40 minutes."
American Tom Danielson of Garmin Sharp was third in 4:09:54.
"The is a fantastic win for me and my teammates," said the 24-year-old Chaves, a third-year pro who claimed his fourth career win. I did not think it was possible until the last two kilometers. To beat guys like Danielson, great champions like Bradley Wiggins is a dream come true."
Chaves, who broke his collarbone last year and competed in only five races, began the day 13th overall. He improved to seventh, trailing by 2:39.
Danielson, riding for Garmin-Sharp, who finished third overall in the event in 2012, escaped with five other riders about 15 miles into the stage. The leaders built as much as a four-minute lead.
But as the riders approached the start of the final 17-mile climb to the ski resort, the main field began to cut its deficit, and the lead group was reduced to four riders.
Wiggins was among about 15 riders who began to chase the faltering leaders and rode much of the rest of the stage following American teammate Joe Dombroski.
The race continues Saturday with an 88.7-mile ride from Santa Clarita to Pasadena.
The stage will include two small climbs, the second with 39 miles left. A sharp descent will take the riders into Pasadena for three three-mile circuits.
The 720-mile event will end Sunday in Thousand Oaks.