Federer suffered his first defeat since May, ending a 22-match winning streak
Rafael Nadal lost to Juan Martin Del Potro and Jo-Wilfried Tsonga shocked Roger Federer as the world's top two players exited the Montreal Masters.
Federer was first to crash out, losing 7-6 (7-5) 1-6 7-6 (7-3) after letting slip a 5-1 lead in the final set.
The Swiss, playing his first event since becoming a father a month ago, had won his previous 22 matches.
Defending champion Nadal saw his first tournament after a 10-week injury break ended by a 7-6 6-1 defeat.
World number one Federer said after his defeat: "All in all I thought it was a decent match.
"I didn't think it was bad but it wasn't great either, so it's one of those matches I can live with."
Federer went into the match in excellent form, having won titles in Madrid, at the French Open and at Wimbledon, where he won a record 15th career Grand Slam crown.
And after losing the opening tie-break, Federer stormed into a seemingly unassailable position by taking the second set 6-1 and moving 5-1 clear in the decider.
But Tsonga battled back with five straight games and, after missing three matches points at 6-5, the Frenchman sealed a famous win in the second tie-break.
"It's obviously disappointing but that's what Jo does - he doesn't put in a return for three hours and then all of a sudden he gets back into the match," said Federer.
"I never should have allowed it but it did happen, so it's a pity."
Tsonga goes on to face Andy Murray in the semi-finals on Saturday and the Briton could overtake Nadal as the world's number two after the Spaniard's defeat by Del Potro.
Nadal returned to action this week after more than two months on the sidelines because of problems with his knees.
After two months out of competition it's tough to play at that level - I needed to concentrate more than usual
The Spaniard fought out a marathon first set with Del Potro that took 78 minutes to complete and ended with Del Potro coming back from 5-2 down in the tie-break to win 7-5.
The Argentine encountered little resistance in a one-sided second set and will now face Andy Roddick, who booked his spot in the final four with a 6-4 7-6 win over fourth seed Novak Djokovic of Serbia.
Despite the defeat Nadal was not too unhappy afterwards, describing the condition of his knees as "very good".
"After two months out of competition it's tough to play at that level - I needed to concentrate more than usual," said Nadal.
"I have to be happy with the tournament. Del Potro is playing very well and I was at the same level as him in the first set.
"I thought if I could win the first set I could relax a little in the second and try again in the third, but it was tough."
Asked if he would be back in top shape for the US Open, which starts on 31 August, he said "we'll see".