Once a Talmid rolled up a tablecloth with a Chumash in it and threw it out. The Rebbi wanted to tell the Talmid that he must ask Hashem for forgiveness in public in order to embarrass him, so that everyone would learn to be careful with Seforim. The Rebbi asked Rav Yitchok Zilberstein Shlit`a, who explained that we say Shemoneh Esray quietly, so that sinners won’t be embarrassed, from which we see that it is not appropriate to embarrass sinners. However he then added that our Gemorah seems to contradict that concept . . .
Mishna: If the entire Korban Pesach became Tamei, one should burn it in front of the Bais Ha`Mikdash . .
The Gemora explains that this is in order to embarrass them.
He quoted the Maharsham, who explains that either here it was appropriate to embarrass him so that he wouldn’t do it again, or that since here the sin was great for it was belittling Kodshim. So too here, concluded Rav Zilberstein, since the reason the Rebbi wants to embarrass him is to prevent him from doing it again and since here too the sin was with a Heilige Chumash, it may be appropriate to do so.