The Scot, defending champion at the grasscourt event, never looked comfortable on the centre court and slid out 6-3 6-7 7-6 in the second-round match. He had received a bye for the first round.
Mahut, the 2008 finalist and now the world number 65, raced through the third-set tiebreak, taking the first six points to win 7-1.
He needed only two of the six match points, with Murray slicing a backhand into the net to end proceedings.
The Frenchman will now play Bulgarian Grigor Dimitrov while Murray, the world number four who was beaten in the French Open quarter-finals, must find another way to prepare for the start of Wimbledon on June 25.
Dimitrov beat 14th seed Gilles Muller of Luxembourg 7-6(1) 6-4 to book his place in the second round.
"Maybe it's the best victory of my career, it was a difficult match and I'm very happy," Mahut, who will always be remembered for a record 11-hour five-minute tussle with American John Isner at Wimbledon in 2010, told the BBC after a mere two and a half hours on court.
"I'm pretty sure Andy will do well at Wimbledon, maybe win this time. I'm really sorry guys, but you will see him winning matches very shortly."
Mahut's second-seeded compatriot Jo-Wilfried Tsonga also overcame a British opponent to go through, beating Jamie Baker 6-3 6-2 in just under an hour.
Tsonga, who is now the favourite to win the tournament, plays Ivan Dogic of Croatia after he beat Japan’s Go Soeda 6-3 7-6.
American Andy Roddick, the seventh seed who has been struggling with injury and was beaten in four sets by Mahut in the first round of the French Open, also went out after losing 6-4 4-6 7-5 to Frenchman Edouard Roger-Vasselin.
Roger-Vasselin will face David Nalbandian after the Argentine veteran beat Belgium’s Ruben Bemelmans 6-4 6-2.
Other second-round matches saw Kevin Anderson move into a third-round clash with Spaniard Feliciano Lopez after the South African’s opponent Sergiy Stakhovsky withdrew late in the third set with the match poised at one set apiece. Lopez needed three sets to beat Belgium’s Steve Darcis 6-3 3-6 7-5.