It was his third victory of this year's Tour and his 18th in total, only four behind American Lance Armstrong.
Frenchman Thomas Voeckler retained his overall race leader's yellow jersey.
LE TOUR STAGE WINNERS
Eddy Merckx (Bel) 34
Bernard Hinault (Fr) 28
Andre Leducq (Fr) 25
Lance Armstrong (US) 22
Andre Darrigade (Fr) 22
Nicolas Frantz (Lux) 20
Francois Faber (Lux) 19
Mark Cavendish (GB) 18
Cavendish now has 251 points in the battle for the green jersey, the prize for the most consistent sprinter, with Jose Joaquin Rojas second on 235, Philippe Gilbert third on 231 and Greipel fourth on 164.
However, opportunities for the sprinters are likely to be limited in the coming days as the Tour heads for the Pyrenees, with Thursday's 12th stage a 211km run from Cugnaux to Luz-Ardiden.
In the 167.5km 11th stage from Blaye les Mines, a storm descended on the riders with around 15km remaining.
A six-man breakaway built a gap of four-and-a-half-minutes and kept the peloton at bay until four kilometres from the finish at Lavaur.
Dutchmam Lars Boom made a valiant attempt for glory before the other leaders were caught but eventually surrendered his advantage two kilometres from the line.
Cavendish had been placed in prime position by his HTC-Highroad team-mates and despite a failing buckle on his shoe, he powered through the rain to the line.
"Finally got my grubby little Manx mitts on the Green Jersey," the 26-year-old quipped on Twitter. "We will try and keep it until Paris. Two more sprints. Montpellier & Paris!"
Having taken the lead in the standings from Belgian Gilbert, Cavendish said: "It's incredible to have the green jersey, it's the most beautiful jersey in the world.
"I have to thank my team-mates for the work they did, even the guys who are in the top 10 overall gave it 100% and that shows what a great team we are.
"There are two more bunch sprints in this year's race and I want to try to win both of them.
"It's not easy fighting for the green jersey but I'm going to keep going and try to keep hold of it right through to the end."
CAVENDISH WINS AT LE TOUR
2011 - Three (after stage 11)
2010 - Five
2009 - Six
2008 - Four
Regarding the incident 600 metres from the finish when his foot accidentally brushed against the front wheel of Romain Feillu, undoing his buckle in the process, Cavendish said: "My foot technically came out of the shoe, I had to reach down and slide the ratchet (buckle) and re-do it.
"I was lucky there were no swerves in the peloton and I had Mark Renshaw to fight for position - it could have been quite dangerous.
"But there was nothing intentional, nothing dangerous between Feillu and me."
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.