Cilic had beaten Querrey in their previous four matches, but the American said his opponent had played better than ever before in the semi-final.
Federer, who is yet to lose a set in this year's tournament, regained some form of revenge for last year's defeat to the Canadian at the semi-final stage in emphatic fashion with a 6-4 6-2 7-6 win in under two hours.
Cilic has also never been this far, at Wimbledon at least.
Defending champion Murray led by a set and a break but was troubled by a hip injury as he lost 12 of the last 14 games to go down 3-6 6-4 6-7 (4-7) 6-1 6-1.
Djokovic had to quit quarter-finals against Tomas Berdych due to right elbow injury while he was trailing 7-6 (7/2), 2-0.
Querrey has now won three consecutive matches in five sets at the All England Club.
Up next for Federer is Tomas Berdych in the semifinals on Friday.
"I believe this is his home court, place where he feels the best and knows that he can play the best game", Cilic said.
"I'm still in a little bit of shock myself", Querrey said. Past year he lost toFederer in the quarterfinals despite winning the first two sets and holding three match points.
Should Federer prevail over Berdych, he will play the victor of Cilic-Querrey on Sunday in the men's final.
After Murray hit two poorly executed drop shots when leading by a set and 4-3 in the second set, Querrey sprung to life, often striking deep returns and rushing to the net in a masterful all-round display.
"I don't see myself playing better than a few years ago but I always hope to improve every year".
The final shot was another mighty forehand down the line, followed by a loud scream for everyone on the grounds to hear, perhaps even Federer and Berdych, waiting in the wings for their chance to play.
Asked if he had considered taking time off during that period, Djokovic said it had been an option, one he will again have to think about.
"Then, of course, it's just discussions I always have, continuous discussion, with my wife about the family, about my kids, is everybody happy on tour, are we happy to pack up and go on tour for five, six, seven weeks". In matches, I couldn't play freely.