Wimbledon champion Andy Murray lost for the first time since May as Ernests Gulbis proved too strong in the third round of the Rogers Cup in Montreal.
The Latvian, ranked 38 in the world, came through 6-4 6-3 in one hour and 28 minutes to reach the quarter-finals.
"Obviously I'd have liked to have done better," said Murray, who later enjoyed success in his second-round doubles match with fellow Scot Colin Fleming.
The pair overcame Leander Paes and Radek Stepanek 6-3 6-3 in 61 minutes.
When his doubles run ends, world number two Murray will move on to next week's Cincinnati Masters before the defence of his US Open title in New York later this month.
"The goal is to try and peak at the US Open," Murray said after his singles defeat.
"But to do that you need to make sure you prepare yourself well.
"There's obviously some things for me to work on, but I think that will come with playing matches."
Montreal was Murray's first tournament since he won the Wimbledon title last month, and he came through his opening match against Marcel Granollers on Wednesday.
Murray, 26, has won the title twice in Canada but any hopes of another long run ended in the last 16 where, having missed the first chance of the match with two break points in game eight, he could not contain the talented Gulbis.
After climbing 100 places in the rankings since the turn of the year and winning the title at Delray Beach, the 24-year-old from Riga notched his first win over Murray in six attempts.
Murray managed an impressive first-serve percentage of over 80% for much of the first set but, when given the opportunity to attack the Briton's second serve, Gulbis took advantage.
A brilliant drop shot helped him to three set points at 5-4, and he took the second with a heavy backhand return off a Murray second serve.
On a hot afternoon in Montreal, it looked a long route back for Murray when he slipped 3-1 down in the second set under a barrage of heavy hitting from Gulbis.
The Scot raised hopes of extending his 13-match winning streak when he broke straight back with a brilliant backhand winner after some magnificent defensive work, but the often inconsistent Gulbis proved far sharper in the closing stages.
A fine lob and another superb drop shot helped him break for the third time to lead 5-3, and he sealed the win with his seventh ace of the day.
"The thing that pleased me the most was that I won," said Gulbis, who goes on to face Milos Raonic, 7-5 6-4 winner over Juan Martin del Potro.
Gulbis added: "I struggled in the first set from the baseline but got more confident and took my chances. I didn't blink when serving out for the match but I didn't play my best tennis. I hope I will be even better tomorrow."
Fourth seed Rafael Nadal earlier beat Wimbledon semi-finalist Jerzy Janowicz 7-6 (8-6) 6-4, while world number one Novak Djokovic needed three sets to overcome Denis Istomin 2-6 6-4 6-4.
There was controversy in Raonic's impressive win over sixth seed Del Potro when the Canadian touched the net while saving a crucial break point in the second set, but the umpire failed to spot the infringement.
"Very upset after the match I lost,'' Del Potro said on Twitter. "About the end ... everyone saw what happened."
Raonic admitted: "I was fortunate that the line judge didn't see it. It's the exact same thing as having no challenges left and you get a bad line call. It's bad luck.
"It was hard to be able to take this point on such a big point."
Canada will have two quarter-finalists for the first time in 24 years after Vasek Pospisil upset fifth seed Tomas Berdych of the Czech Republic 7-5 2-6 7-6 (7-5).