The Chasam Sofer indeed said this, in his last responsum on Yoreh Deiah (# 356):
והאומר אין משיח וקים לי' כרבי הלל הרי הוא כופר בכלל התורה דכיילי אחרי
רבים להטות כיון שרבו עליו חכמי ישראל ואמרו דלא כוותי' שוב אין אדם
ראוי' להמשך אחריו
And one who says "there is no Messiah for Israel" and holds like Rabbi
Hillel is a denier of the Torah because we measure by the majority.
Since the Sages of Israel amassed against him and they said not like
him, henceforth it is improper for anyone to follow after him.
Rabbi Hillel's view is found in Sanhedrin 99a:
ר' הילל אומר אין להם משיח לישראל שכבר אכלוהו בימי חזקיה אמר רב יוסף
שרא ליה מריה לרבי הילל חזקיה אימת הוה בבית ראשון ואילו זכריה קא מתנבי
בבית שני ואמר גילי מאד בת ציון הריעי בת ירושלים הנה מלכך יבא לך צדיק
ונושע הוא עני ורוכב על חמור ועל עיר בן אתונות
R. Hillel said: There shall be no Messiah for Israel, because they
have already enjoyed him in the days of Hezekiah. R. Joseph said: May
God forgive him [for saying so]. Now, when did Hezekiah flourish?
During the first Temple. Yet Zechariah, prophesying in the days of the
second, proclaimed, Rejoice greatly, O daughter of Zion, shout, O
daughter of Jerusalem, behold, thy king cometh unto thee! he is just,
and having salvation, lowly, and riding upon an ass, and upon a colt
the foal of an ass. (Soncino translation)
Note that this does not appear to be the consensus of rishonim on how to deal with Rabbi Hillel's opinion. In fact several rishonim use this as a proof that Rambam is incorrect that belief in the Messiah is a fundamental belief.
For instance, R. Joseph Albo writes the following:
Sefer HaIkkarim 1:1
אלא שבלי ספק רבי הלל לא היה מאמין בביאת המשיח כלל ואף על פי כן לא היה
נמנה בכלל הכופרים לפי שאין ביאת המשיח עקר לתורת משה כמו שכתב הרמב"ם
ז"ל כי כבר יצוייר מציאותה זולתו
Rather, without a doubt Rabbi Hillel did not believe in the coming of
the Messiah at all, and even so he was not counted among the deniers
because the coming of the Messiah is not fundamental to the Torah of
Moses like Rambam of blessed memory wrote since it's [Judaism's]
existence is already conceivable without it [the Messiah].
Similarly, R. Isaiah (the Younger) of Trani writes the following:
Riaz Kuntres HaRayos Sanhedrin 90a
שהרי הלל שהיה מחכמי התלמוד היה אומר אין משיח לישראל שכבר אכלוהו בימי
חזקיהו וכל המקראות שנאמרו על הגואל היה מפרשן לשעבר ולא נקרא כופר בכך
For behold Hillel – who was of the Sages of the Talmud – would say
"there is no Messiah for Israel because they already consumed it in
the days of Hezekiah", and all the verses that were said about the
redeemer he would explain [as referring] to that which has passed, and
[yet] he was not called a denier for this.