Madrid fell behind to Jasurbek Yakhshiboev’s header in the first half but Karim Benzema’s penalty appeared to have spared the blushes of the Spanish giants, only for Thill to snatch an incredible victory.
The result will go down as one of the most surprising in the history of the competition and delivers a significant boost to Sheriff’s chances of qualifying for the last 16.
They now have six points out of six in Group D, having already beaten Shakhtar Donetsk.
When Sheriff were founded in 1997, Madrid were about to win the seventh of their 13 European Cups.
Sheriff have since won 19 out of the last 21 Moldovan titles including the last six.
Yet upsetting the world’s most prestigious teams is less a football fairytale than a success story for a conglomerate company that controls businesses ranging from a cognac distillery to supermarkets, and a football club.
While Sheriff play in the Moldovan league, they are from Transnistria, a pro-Russian separatist state created after a civil war following the collapse of the Soviet Union.
The territory is effectively run by the Sheriff holding company, which sports a five-pointed sheriff’s star as its logo.
The question marks around the history of the club, however, could not detract from the satisfaction felt by the players, who celebrated the win at the final whistle as if they had won the entire tournament.
Thill, Sheriff’s match-winner, was last year playing on loan at Russian club FC Tambov, who in May were dissolved after declaring themselves bankrupt.
Real Madrid have time to recover but this is an unexpected setback for what has otherwise been an encouraging start under Carlo Ancelotti.
They were the more authoritative early on, but Sheriff scored with the first opportunity they got.
David Alaba was tempted out to press and as the ball was spread left, the sprinting defender was unable to catch up with Yakhshiboev, who headed in a perfectly weighted cross from Cristiano.
Madrid improved towards the end of the half but not before Sheriff could have made it two, Thibaut Courtois coming out to clear a ball over the top, only to sidefoot it straight to Frank Castaneda. He fed Yakhshiboev, who curled just wide.
Vinicius chipped past the post after a smart dummy by Eden Hazard, who then had a go himself from the angle but his shot was parried away.
The Madrid pressure kept coming in the second half as Vinicius appealed for two penalties in quick succession, the second given after a check from VAR.
The Brazilian had flicked the ball between Costanza and Edmond Addo, and gone down over the knee of the latter.
Benzema banged in the penalty and carried the ball back to the halfway line but it was Sheriff who had the ball in the net next, Bruno Souza diverting in at the near post, only to see it ruled out for offside.
Luka Modric’s shot hit Giorgos Athanasiadis in the face and the goalie hen recovered to deny Eder Militao. Rodrygo blazed over from Vinicius’ cutback.
Sheriff appeared to be hanging on for a draw but instead delivered a knock-out blow. A throw-in was hooked back to the edge of the area, where Thill unleashed a wonderful shot into the top corner.