(Refiles to fix coding)
By Tom Bartlett
MONTREAL Aug 8 (Reuters) - Andy Murray's U.S. Open preparations suffered a setback when he was upset 6-4 6-3 by an inspired Ernests Gulbis in the third round of the Rogers Cup on Thursday.
Playing just his second match since his Wimbledon triumph, Murray surrendered in less than 90 minutes to the Latvian world number 38, who produced some breathtaking shots on the Montreal hardcourt.
The loss leaves Briton Murray with only the Cincinnati Masters to fine-tune his game before the defence of his U.S. Open title, having enjoyed a long lay-off in the wake of his second grand slam crown.
"The goal is to try and peak at the U.S. Open," Murray told reporters. "But to do that you need to make sure you prepare yourself well and obviously I would have liked to have done better here."
Gulbis will now face Canadian Milos Raonic in the quarter-finals.
Rafa Nadal, also back in action for the first time since Wimbledon, was given a tough workout by Poland's Jerzy Janowicz but survived to win 7-6 6-4.
Janowicz served for the set and led 3-0 in the second but was unable to capitalise on his chances.
"It was a very good victory against a very difficult opponent," Nadal told reporters.
"He played a little up and down but I'm pleased with the way I played ... It's a great victory for me."
Nadal's next opponent is Australian qualifier Marinko Matosevic, who celebrated his 28th birthday with a 7-6(7) 6-7(10) 6-3 victory over Benoit Paire of France.
World number one Novak Djokovic had to come from a set down to beat a free-spirited Denis Istomin under the centre court lights.
The Serbian was out of sorts at the beginning of his second match as Istomin went for his shots and found the lines with some scintillating tennis.
Djokovic, however, recovered and produced some of his own magic in the second set before he celebrated a hard fought 2-6 6-4 6-4 victory by thrilling the late night crowd with another dancing routine on the centre court, this time wearing a 1970s styled wig.
Djokovic's quarter-final opponent will be French number one Richard Gasquet, who similarly staged a comeback to send Japan's Kei Nishikori home.
Canada's challenge in the tournament reached heights not seen by the locals in over 20 years when 11th seed Raonic joined his 71st ranked compatriot, wildcard Vasek Pospisil, in the last eight.
Raonic ended Del Potro's impressive recent run with a 7-5 6-4 victory while Pospisil chalked up his first ever win over a top 10 player when he held his nerve in a thrilling deciding tiebreak to shock Czech fifth seed Tomas Berdych.
Pospisil had already beaten in-form American John Isner and another Czech in Radek Stepanek to reach the third round.
He will meet another experienced campaigner, Russia's resurgent former world number three Nikolay Davydenko, in his debut Masters series quarter-final. (Reporting by Tom Bartlett; editing by Julian Linden / Ian Ransom)