The Frenchman said his legs gave way shortly after the red flat signalling one kilometre to the finish line.
But as the finish line loomed, Casar, who came a very close second to compatriot Cedric Vasseur last week, dug deep to surge ahead of Boogerd to beat the Rabobank rider in what is his final Tour de France.
The 29-year-old pumped his right fist as he crossed the line in 5 hours, 13 minutes, 31 seconds, followed by Merckx and Lefevre.
"Finally! It's been a while that I've been waiting for this," Casar said. "I almost dropped out after the fall - I didn't see it coming."
Casar's spectacular crash occurred after a dog wandered from the left hand-side of the road which was packed with spectators.
The Frenchman first hit the dog, then the tarmac on a slight descent as the quartet tried to stretch their advantage.
"The dog wasn't on the leash, so of course it surprised me," said Casar, who was left with grazes on his right buttock.
"I waited as long as I could, then just went for bust. A finish after a slight incline is what suits me best," he said.
Tom Boonen of Belgium cemented his hold on the green jersey given to the race's best sprinter by leading the pack across the finish line, 8 minutes, 43 seconds after Casar.
|Casar's win was a painful |
sight for other riders [EPA]
With the race heading into Saturday's crucial stage - a 55.5km individual time trial from Cognac to Angouleme - Cadel Evans of Australia gained three seconds against Contador in the overall standings as the pack split near the finish. He now trails Contador by 1 minute, 30 seconds, with two stages left.
US cyclist, Levi Leipheimer is third, 2 minutes, 49 seconds behind first place.
"This yellow jersey is very important. It's important that I have it tonight," said Contador, who rides with the Discovery Channel team. "Tomorrow is the most difficult day of my career as an athlete.
"In this time trial, everything can change, my entire life can change - and I hope I'll keep it."
The Tour has been reeling from Wednesday's withdrawal of race leader Michael Rasmussen and several doping scandals. The Danish rider was kicked out of the race by his own Rabobank team on Wednesday.
Denmark's cycling federation announced on July 19 it had sacked Rasmussen for missing doping tests in June.
He said it was an oversight and claimed he was in Mexico - where his wife is from - in June, but former rider Davide Cassani said he had seen Rasmussen in Italy.
Rasmussen left a pack of dispirited riders heading toward the weekend finish in Paris, burdened by the latest jolt to the sport.
On Tuesday, crowd-pleasing Kazakh cyclist Alexandre Vinokourov was ejected for testing positive for a blood transfusion after Saturday's stage.
A day later, it was announced halfway through Wednesday's stage that Cristian Moreni had tested positive for testosterone.