Fourth seed Murray lost the battle between the two beaten semi-finalists at last year's tournament in the Italian capital. Gasquet, seeded 16th, will now face David Ferrer in the quarter-finals after the Spanish claycourt specialist beat Gilles Simon 6-0 7-6(4).
Murray had reached the quarter-finals in Monte Carlo but pulled out of the Madrid Masters with a back injury before winning his opening match in Rome.
The Scot said his back had been a problem for several months and admitted it was a concern heading into the French Open, which begins on May 27.
"I don't really want to go into detail of what it is and what treatment I've had done, but I've had it a while, since December," Murray said.
"Since then there hasn't been that much time to take an extended break and now with the French Open, Wimbledon, Olympics and the US Open to come, there's not much time to take a rest.
"But hopefully by the time the French Open comes around I'll be in peak condition. That's the goal."
Murray came into this match off the back of a draining three-set encounter against David Nalbandian, but the world number four was well beaten by his French opponent after winning a tight first set on a tie-break.
The British number one was initially getting a lot of joy using drop shots and short slices against the player he has shared several epic encounters, and he got his nose ahead in the seventh game by converting his seventh break point of that game and his 11th of the set overall at that point.
Gasquet rescued a set point on his next service game and broke back in the 10th through a combination of anticipating Murray's gameplan well and the Scot himself making several unforced errors.
After fighting his way back into contention, Gasquet went missing in the first-set breaker, only winning one point as Murray cruised to take the opening set.
However, the world number 22 responded emphatically by breaking Murray in the very next game to 15 via a dazzling variety of winners.
The Frenchman then broke again in the fifth game as Murray's could not hide his frustration on court. Murray hit back with a break of his own via a cross-court two-hander, but Gasquet broke back immediately to force a deciding set for the fourth time in six meetings between these two.
In a pivotal third game of the final set, Murray cried out in anguish as he spurned several break-point opportunities before Gasquet held serve before going on to break in the sixth game of the set against a visibly drained and angry Murray.
Murray had won the last two matches against Gasquet which had gone the distance, but he was running out of ideas as Gasquet second-guessed almost every move he made, putting him out of his misery with a final break of serve in the eighth game.
There were no such problems for Nadal, a five-times champion in Rome and last season's runner-up, as he cruised into the last eight with a 6-1 6-1 win over fellow Spaniard Marcel Granollers.
Nadal broke Granollers five times and saved all three break points he faced in an 88-minute victory.
"I started the match bad with two double faults with my serve, but after the first two or three games, I started to play well - good forehand, control of the point and going to net," he said.
"Conditions were difficult and windy but I think I found rhythm and after third game I played very solid."
The world number three will now face Tomas Berdych in the quarter-finals after the big-serving Czech defeated Nicolas Almagro 7-6(3) 6-3, and Nadal was left expecting a tough match.
"His level is fantastic on clay and hard and grass," said Nadal. "He is a complete player and so tomorrow will be a difficult match for me. If I play my best, it will be possible."
- Related links