First, a look at the sources.
You reference Sanhedrin 99b, as a source that it is forbidden to embarrass others. This is the relevant passage:
אפיקורוס. רבי ורבי חנינא אמרי תרוייהו: זה המבזה תלמיד חכם. רבי יוחנן ורבי יהושע בן לוי אמרי: זה המבזה חבירו בפני תלמיד חכם
Two opinions are cited regarding the identity of the epikoros. Either one who shames a talmid hakham, or one who shames someone else in front of a Torah scholar.
Rambam (Hilkhot Teshuva 3:14) rules in accordance with the first view. (Although he does include other cases of embarrassing others, as well).
However, this is all moot, since the issue of who is called an epikoros is independent of the question of what is and is not permitted.
Regarding what is and is not permitted, using words to hurt other people is forbidden whether or not it is in front of a Torah scholar. (cf. Leviticus 25:17, Sefer HaMitsvot neg. 251, Hilkhot Teshuva 7:8).
This includes making someone feel stupid by emphasising his lack of knowledge (Perush HaMishna on Bava Metzia 4:10). While it is hard to prove the negative, these sources do not differentiate between whether the person ought to be offended by the jabs; they seem to forbidden regardless, if other person is hurt. (Incidentally it could be argued that having one's shortcomings highlighted is a reason for hurt, whether or not the one highlighting them, or others, are aware of the identity of the subject).
However, there is an important exceptions to this. Rambam implies that this prohibition applies when intending to hurt someone in Perush HaMishna (ibid):
ועוד שהאדם יכול לעשותה בתחבולה...או שיציע לאדם שאינו מלומד דבר חכמה ויאמר לו הסבר לי דבר זה כדי לביישו, ויאמר אני חשבתי שהוא מאנשי החכמה. או שיספר ספור ויכלול בו מגרעות איזה אדם ומומיו, ויאמר אני לא נתכוונתי למה שחשבתם. לפיכך אמר ויראת מאלהיך היודע כוונותיך ומחשבותיך, וזהו ענין אמרם כל דבר שהוא מסור ללב נאמר בו ויראת מאלהיך
Additionally, a person can do it underhandedly...Or he can present an unlearned person a matter of learning, and say: 'explain this matter to me' in order to shame him, and he could claim 'I thought he was one of the learned'. Or you could relate a story and include in it a person's shortcomings and flaws, and claim: 'I didn't intend for that [negative point] which you thought'. Therefore, God said: 'And you should fear your God', who knows your intentions and thoughts. And this is the intent of Hazal's statement: 'Regarding anything dependent one's thoughts, it is stated 'And you should fear your God'.
Similarly, in Hilkhot Teshuva (7:8), he describes the prohibition of shaming others as specifically where it is intended to hurt them:
וחטא גמור הוא לומר לבעל תשובה זכור מעשיך הראשונים...כדי לביישו...הכל אסור ומוזהר עליו בכלל הוניית דברים שהזהירה תורה עליה שנאמר ולא תונו איש את עמיתו.
So, like other interpersonal mitsvot, the prohibition of shaming others intends on the intent. It is specifically prohibited if the goal is to hurt others.
Therefore, in the case of a harsh comment, only the poster and God can know whether the intent was to shame the subject, and therefore prohibited, or for some ulterior purpose, such as emphasising a mistake to protect others from false information, and therefore permitted.