Marcel Kittel overpowered Mark Cavendish in a photo finish to take his third stage win of the 100th Tour de France.
Cavendish got the lead-out he wanted from Gert Steegmans but then saw Kittel come from a bike-and-a-half's length back to take the win.
The margin at the line was half a wheel, but the sight of Cavendish losing a sprint finish from such a position of strength was a major surprise.
Cavendish had been looking for a 25th career Tour stage win, which would have moved him level with Andre Leducq for third all-time in Tour history, but will instead be left to reflect on yet another frustrating day in France.
Although he won stage five to Marseille, he has otherwise endured setbacks and disappointments when he hoped to be racking up victories and competing for the points leader's green jersey.
This time, Cavendish could not point the finger at his Omega Pharma-Quick Step lead-out as they beat Kittel's Team Argos-Shimano squad to the final straight.
Points leader Peter Sagan came home third, and now leads Cavendish by 96 points in the battle for the green jersey.
It was a tight and twisty final kilometre but a crash three kilometres from the line had split the peloton to leave plenty of room.
There were Team Sky riders caught in that crash, but Chris Froome was ahead of the trouble as David Lopez shepherded him home to maintain his three minute and 25 second overall lead in the general classification.
Immediately after, Kittel told French television he was dedicating the victory to his team-mate Tom Veelers, another reminder of Cavendish's troubles here at the Tour.
The Manxman was sprayed with urine by a spectator during yesterday's time trial to Mont-Saint-Michel in an apparent protest at his actions a day earlier, when he crashed into Veelers in the final 100 metres of stage 10 to Saint-Malo.
Race organisers absolved Cavendish of blame for the crash, but Veelers and many fans saw it differently, and while one spectator took things to extremes, many others whistled and jeered Cavendish during yesterday's time trial.
Cavendish began the day by saying he was keen to put both incidents behind him, having spoken to Veelers on the phone to clear the air.
Speaking before the start of today's stage, Cavendish said of the urine thrown: "It's not a nice thing to happen but in cycling you get so close to the spectators.
"I enjoy that really because there was an incredible amount of British support there and Manx flags. I didn't know there were that many people on the island."
Asked about Veelers, he added: "I spoke with Tom the other day on the phone and we'll get back to bike racing today.
"He's got an incredible sprinter in Marcel Kittel and it's going to be a big battle today."
Those predictions proved to be on the money, but only after Cavendish had come out fighting.
For the first time in the Tour so far he beat his green jersey rivals over the line in the intermediate sprint, finishing ahead of Andre Greipel by a hair's breadth, with Sagan next in line.
However, Cavendish was only sixth at that point as Astana's Francesco Gavazzi had led a five-man breakaway through the intermediate sprint, with Juan Antonion Flecha (Vaconsoleil) close behind.
Manuele Mori (Lampre-Merida), Romain Sicard (Euskaltel Euskadi) and Anthony Delaplace (Sojasun) were the other men in that break, which went early and enjoyed a lead which grew to as much as nine minutes.
But the peloton were closing in and four of them were caught with 12km to go, while Flecha's late attack off the front came to an end with 6km remaining.
The sprint teams then gathered to fight for position but there was a reminder of the dangers to come within Tours itself as Orica GreenEdge's Svein Tuft crashed at the front of the peloton as they negotiated a roundabout.
He was the only man to go down that time but when a Lotto-Belisol rider fell inside the final three kilometres it was another matter as around 20 others tumbled in the resulting pile-up.
Sky's Richie Porte and Edvald Boasson Hagen were among them, and the Norwegian eventually crossed the line holding his shoulder before going for further examinations.
Froome said: "My team did a fantastic job today. I was just staying on their wheels and staying out of trouble.
"There's no such thing as an easy day in the Tour de France and even today it was still a hard day out there.
"I did hear the crash behind me and unfortunately Boasson Hagen has been caught up in it. He has a bit of pain in his shoulder and he's with the doctors now.
"He's a huge part of the team so we hope he's alright."
Watch Stage 12 highlights and reaction
More Tour de France news
Rolling Tour photo gallery
Live Tour standings
Follow ITV Cycling on Twitter