As a result of Federer's loss, Rafael Nadal will reclaim top spot in the ATP rankings on Monday.
Coric took a little over two hours to claim his first grass court title.
If Federer had won, he would have competed for his 100th career title at 2018 Wimbledon.
Coric, who accounted for German second-seed Alexander Zverev in the first round, held his nerve against the crowd favourite at the venue that styles itself after the All England club. The Swiss fired a dozen aces but lost serve twice.
"I actually thought I played maybe my best match of the week today".
However, the Swiss missed out on his 99th tour-level title after the Croatian took a comfortable 6-2 win in the third set, and his first title on grass.
He had won the tournament nine times while reaching the finals 12 times in his career.
Former US Open champion Cilic also lost the 2013 Queen's final and experienced fresh heartache against Federer in this year's Australian Open final. It is his 54th consecutive victory on grass with a fifth successive Wimbledon title equalling the record set by Borg.
"It was a big relief because there was pressure from all sides, especially from myself, to do better in Slams", said the 21-year-old before dedicating the win to former coach Peter Carter who died in a auto crash in South Africa earlier in the year.
"Until then, I don't think I had one break point".