The Rabobank all-rounder attacked from a five-man break 10 kilometres from the finish of the 191km stage to secure his fourth career win in the Tour.
But the battle for the GC was put on hold in bizarre scenes on the descent of the last of three climbs, the Cat.1 Mur de Peguere, just under 40km from the finish in Foix.
A series of punctures - including three for defending champion Cadel Evans - brought about a truce on the front of the main peloton from the Sky team of race leader Bradley Wiggins.
Race commissaires later confirmed that a number of thumb tacks and pins had been found on the road and that police have been asked to investigate the issue.
"One or two spectators had thrown nails onto the road. We don’t know why, but there were around 30 punctures altogether," said race director Jean-Francois Pescheux, who confirmed that the sharp carpet tacks had been thrown onto the ground around 200m from the summit.
"Sky showed they are for fair play," added Pescheux. "They saw that something had happened and they slowed the peloton so that things could come together for the ride to the finish."
After a period of confusion - in which one rider, Pierre Rolland (Europcar), initially took advantage of the situation with a big attack on the final descent - the race came back together. The peloton eventually came home more than 18 minutes down on stage winner Sanchez.
There was no change in the overall standings with Wiggins retaining his yellow jersey. The Briton leads Sky team-mate Chris Froome by 2:05 with Italian Vincenzo Nibali (Liquigas) in third, 2:23 down. Despite his scare Australian Evans stays fourth, 3:19 in arrears.
Sanchez was part of an initial 11-man breakaway that formed on the first climb of the day, the Cat.3 Col du Portel, 30km from the start in Limoux. Instigated by green jersey Peter Sagan, the break had built up a huge lead of 12 minutes by the time Sagan crossed the intermediate sprint in pole position to consolidate his near-insurmountable position in the points classification.
The lead of the break rose to 14 minutes after the Cat.1 Port de Lers climb 65km from the finish - but it was not until the eagerly anticipated Mur de Peguere climb that the race exploded.
The narrow first category ascent was being used for the first time in the Tour's history - and it was Sanchez who sparked a selection on the steep mid-section of the climb. Three riders - Frenchman Sandy Casar (FDJ-BigMat), Spaniard Gorka Izagirre (Euskaltel) and Belgian Philippe Gilbert (BMC) - were able to match the pace of Sanchez on the precipitous 18 per cent ramp.
Sagan showed his staggering all-round abilities by returning to the wheel of Sanchez, sparking a counter-attack by Casar. The Frenchman crossed the summit with a handful of seconds over the remaining four riders - but it all came back together on the long descent into Foix.
Unaware of the drama that was about to unfold behind them, the five leaders combined until Sanchez caught his fellow escapees napping with a measured attack 12km from the finish.
The Spaniard soon built up a large lead and was able to enter the final kilometre safe in the knowledge that the stage was his. It was a great turnaround for a rider who, 24 hours earlier, had been caught in the closing 200m of stage 13.
Twenty-eight-year-old Sanchez turned round to his Rabobank team car and punched the air before crossing the line to secure the fourth Tour stage victory of his career. The win was a welcome tonic to his Rabobank team, who are down to just four riders following a series of crashes in the opening week of the race. Sanchez himself hurt his wrist in a heavy fall during stage one and was almost forced to retire.
Sagan took second place ahead of Casar, Gilbert and Izagirre, 47 seconds behind Sanchez. The Slovak now has 333 points in the green jersey standings and will take the prize in Paris barring an accident.
While the cream of the escapees were competing for the win, however, the race took on a whole new dynamic back with the yellow jersey group. A stalemate of sorts already seemed to have been declared as Wiggins led the group across the summit of the Mur de Peguere when Evans stopped with a rear wheel puncture.
With team cars not allowed up the climb due to the narrow roads, Evans was forced to wait for a BMC team-mate before he could start the descent. When, some 40 seconds later, the first BMC rider arrived, he too had a puncture. Evans eventually managed to change his wheel - but in the ensuing chase picked up two more punctures.
The Australian was not the only one with problems, with more than 30 riders requiring wheel changes - including Wiggins. Astana's Robert Kiserlovski also crashed heavily and was forced to withdraw from the race.
As chaos and confusion reigned, Wiggins ordered a go-slow on the front of the main pack - although Frenchman Rolland must have not received the orders because the Europcar climber suddenly attacked.
Sitting ninth in the GC, 8:31 seconds down on Wiggins, the stage 11 winner clearly saw a chance to improve his position in the top ten. Rolland was almost two minutes ahead of the yellow jersey group when he was apparently ordered to ease off by his team management.
"People have reproached me for having attacked on the descent but I was not in the know about the mechanical problems behind me," said Rolland. "I am not the type of rider who likes to benefit from other people's misfortunes to gain places in the GC."
The race came back together and the peloton eventually crossed the line 18:15 down on Sanchez.
"No one wants to benefit from someone else's misfortune," Wiggins said after the stage. "When everyone punctured I thought the honourable thing to do was to wait."
The Tour continues on Monday with the 158.5km stage 15 from Samatan to Pau which includes three minor climbs.