Georg Totschnig won the 220.5km 14th stage as six-time Tour winner Lance Armstrong extended his overall lead on day one of three in the Pyrenees.
Austrian Totschnig led early, joining a 10-man escape group at 7km before a pursuing pack, including Armstrong, closed the gap in the final 20km.
But the Gerolsteiner rider, 34, had just enough breathing space to triumph.
American Armstrong retained his yellow jersey after finishing 56 seconds back, while Italy's Basso was third.
Another yellow jersey contender, 1997 winner Jan Ullrich, finished around 10 seconds behind Armstrong, who holds a lead of one minute 41 seconds over Dane Mickael Rasmussen.
Ullrich's team-mate Alexandre Vinokourov was one of the biggest losers on the day, finishing nearly three minutes behind.
Meanwhile Totschnig became only the second Austrian to win a stage of the Tour de France after Max Bulla in 1931.
After instigating a 10-man breakaway 7km into the stage from Agde to Ax-3 Domaines, they held a maximum lead of more than nine and a half minutes over the peloton on the Port de Pailheres.
The front group broke up on the climb and Totschnig took the lone lead when he dropped 2000 Giro d'Italia champion Stefano Garzelli 5km from the top.
"I attacked early in the morning, knowing it was my only chance. I'm surprised because I was ill before the start," said the Austrian.
Armstrong was forced to work for second place after being left isolated from his Discovery Channel team-mates when the peloton broke up on the climb up the 'beyond category' Port de Pailheres.
He found himself in a group which included seven other riders ranked in the overall top 10 but kept his cool and survived a series of attacks.
The group dwindled to three on the climb to the finish with only Basso and Germany's Ullrich able to stay with the yellow jersey.
Ullrich cracked in the final kilometre and Armstrong wound the pace up to deny Basso second and keep the lead.
"I had a hard time because of the heat. It was a really hard day," said Armstrong.
"When the T-Mobile attacked, I was feeling really well. The only problem is that I was alone but I knew they could not go on and on at that pace."
Stage 14 result:
1 Georg Totschnig (Aut) 5hrs 43mins 43secs
2 Lance Armstrong (USA) at 0.56secs
3 Ivan Basso (Ita) at 0.58
4 Jan Ullrich (Ger) at 1.16
5 Levi Leipheimer (USA) at 1.31
6 Floyd Landis (USA) at same time
7 Francisco Mancebo (Spa) at 1.47
8 Mickael Rasmussen (Den) at same time
9 Andreas Klöden (Ger) at 2.06
10 Haimar Zubeldia (Spa) at 2.20
1. Lance Armstrong 55:58:17"
2. Mickael Rasmussen +1:41"
3. Ivan Basso +2:46"
4. Jan Ullrich +4:34"
5. Levi Leipheimer +4:45"
6. Floyd Landis +5:03"
7. Francisco Mancebo
8. Andreas Kloeden +5:38"
9. Alexandre Vinokourov +7:09"
10. Christophe Moreau +8:37"