Reviling Someone in Secret
Question

Is it permissible to revile someone, but in my own heart and secretly, in such a way that no one knows that I reviled so and so, such as if I said to myself, “O so and so, O …, Why did you do such and such to me?” Am I sinning if I do that?
Praise be to Allah.Reviling and impugning may be either justifiable or unjustifiable. 
Firstly: 
If it is justifiable, such as if a Muslim is wronged in an obvious manner, or is harmed in a way that cannot be denied, then there is nothing wrong with warding off harm and enmity from oneself by reviling and impugning, whether that is done secretly or openly, without transgressing or overstepping the mark, although it is better not to do that. 
Allah, may He be exalted, says (interpretation of the meaning): 
“Allah does not like that the evil should be uttered in public except by him who has been wronged. And Allah is Ever All‑Hearer, All‑Knower” [4:148]. 
As-Sa‘di (may Allah have mercy on him) said: 
Here Allah tells us that He does not like evil to be uttered in public, i.e., He hates that, dislikes it and punishes for it. That includes all bad words that may cause hurt and make people sad, such as reviling, slandering, impugning and so on. All of that comes under the heading of forbidden things that Allah hates. 
What is implied is that Allah loves good kinds of speech such as dhikr (His remembrance) and kind and gentle words. 
“except by him who has been wronged” means, it is permissible for him to pray against the one who has wronged him, and to make a complaint about him. He may speak out openly against the one who uttered evil against him publicly, without telling lies about him and without going any further in wrongdoing than he did. And he should not overstep the mark and revile anyone other than the one who wronged him. Yet despite that, forgiving him and not responding in kind is preferable, as Allah says: “but whoever forgives and makes reconciliation, his reward is with Allah” [42:40]. End quote. Tayseer al-Kareem ar-Rahmaan. 
Allah, may He be exalted, says (interpretation of the meaning): 
“And indeed whosoever takes revenge after he has suffered wrong, for such there is no way (of blame) against them.
The way (of blame) is only against those who oppress men and rebel in the earth without justification; for such there will be a painful torment” [42:41-42]. 
It was narrated from Abu Hurayrah (may Allah be pleased with him) that the Messenger of Allah (blessings and peace of Allah be upon him) said:
“When two people revile one another, the sin of what they say is on the one who started it, so long as the one who is wronged does not overstep the mark.”. [Muslim] 
The best supplication that the one who is wronged may offer concerning the wrongdoer is that which was narrated from the Prophet (blessings and peace of Allah be upon him) by Jaabir (may Allah be pleased with him) who said: The Messenger of Allah (blessings and peace of Allah be upon him) used to say: “O Allah, correct my hearing and my sight, and allow me to retain them until I die. Lead me to victory over those who have done me injustice and allow me to see vengeance.”  [al-Bukhaari in al-Adab al-Mufrad]
Al-Khateeb ash-Sharbeeni (may Allah have mercy on him) said: 
If one person reviles another, it is permissible for the one who was reviled to revile him back as much as he reviled him, because Allah, may He be exalted, says (interpretation of the meaning): “The recompense for an evil is an evil like thereof” [42:40]. It is not permissible for him to revile his father or mother. It was narrated that when Zaynab reviled ‘Aaishah, the Prophet (blessings and peace of Allah be upon him) said to her – as narrated in Sunan Ibn Maajah and classed as saheeh (authentic) by al-Albaani: “You should say something to defend yourself.” [‘Aaishah said:] So I turned on her, until I saw that her mouth had become dry, and she did not say anything back to me. And I saw the Prophet with his face shining. Rather all that is permitted is reviling which does not involve lying or slander, such as saying, “O wrongdoer” or “O fool”, because hardly anyone is free from these descriptions. Once a person has stood up to defend himself  by reviling the one who reviled him, then the matter is settled and the first person is in the clear, but he has the sin of initiating the exchange and the sin of transgressing the limits set by Allah. End quote. Mughni al-Muhtaaj. 
But it is far better and closer to perfection to forgive, pardon and overlook, in the hope that Allah will pardon us on the Day of Resurrection, for the recompense will fit the nature of the deed. 
Allah, may He be glorified and exalted, says (interpretation of the meaning):
“The recompense for an evil is an evil like thereof; but whoever forgives and makes reconciliation, his reward is with Allah. Verily, He likes not the Zaalimoon (oppressors, polytheists, and wrongdoers)” [42:40]. 
And the Prophet (blessings and peace of Allah be upon him) said: “O ‘Uqbah ibn ‘Aamir, uphold ties with those who cut you off, give to those who withhold from you, and forgive those who wrong you.” [Ahmad]
It was narrated that ‘Aaishah (may Allah be pleased with her) said that a blanket of hers was stolen, and she started to pray against the one who had stolen it. The Prophet (blessings and peace of Allah be upon him) said: “Do not reduce his burden of sin by making du‘aa (supplicating) against him.” [Abu Dawood]
There are also reports from the Taabi‘een (successors) that point to the superiority of forgiving and overlooking in this world. 
Al-Haytham ibn Mu‘aawiyah said: 
Whoever is wronged and does not retaliate in word or deed, and does not bear resentment in his heart, that will be his light among people. End quote. [al-Bayhawi in Shu‘ab al-Eemaan] 
Secondly: 
If the reviling and impugning is done unlawfully, i.e., as a result of personal resentment or hatred based on malicious envy (hasad), or because one dislikes a person’s appearance, lineage, conduct or anything else that results in people reviling and insulting others, this is something that is clearly forbidden and comes under the heading of slips of the tongue that consume (i.e., wipe out) good deeds and incur punishment for bad deeds, whether it is done secretly or openly. 
It was narrated from ‘Abdullah ibn Mas‘ood (may Allah be pleased with him) that the Prophet (blessings and peace of Allah be upon him) said: “Insulting a Muslim is an evil action and fighting him is kufr (disbelief/denial).” [al-Bukhaari, Muslim]. 
It was also narrated from him (may Allah be pleased with him) that the Prophet said: “The believer is not given to insulting, cursing a great deal, obscene talk or foul speech.” [ at-Tirmidhi]. 
Al-Mubaarakfoori (may Allah have mercy on him) said: 
“The believer” means: the perfect believer
“is not given to insulting” i.e., criticizing people
“or cursing a great deal” i.e., cursing excessively, because the perfect believer can hardly be free from some shortcomings
“obscene talk” i.e., he does not commit obscene actions or utter obscene speech
“or foul speech” al-Qaari said: this refers to the one who has no shame. End quote. Tuhfat al-Ahwadhi. 
Thirdly: 
If the reviling or impugning occurs in one’s heart or mind, such as a thought that crosses the mind without one meaning it to or uttering it out loud – rather it is some passing thought or whispers that may come to mind about reviling so and so, but he does not pay attention to it or resolve to do it – then this comes under the heading of passing thoughts that are forgiven, in sha Allah, because the Prophet (blessings and peace of Allah be upon him) said: “Allah has forgiven my ummah (followers) for what crosses their minds so long as they do not act upon it or speak of it.” [al-Bukhaari and Muslim] 
But there is the fear that if these thoughts become persistent and settle in the heart, they may come under the heading of deeds of the heart for which a person will be brought to account. 
Al-Qaasimi (may Allah have mercy on him) said: 
As for the effects of anger on the heart, such as resentment, malicious envy, wishing ill, rejoicing in the misfortunes of another, begrudging his happiness, resolving to spread his secrets and transgress his privacy, making fun of him, and other evil actions, these are the fruits of excessive anger. [from Tahdheeb Maw‘izat al-Mu’mineen] 
Al-Ghazaali (may Allah have mercy on him) said:
It should be noted that thinking bad things is haram (impermissible), just like saying bad things. Just as it is haram for you to say bad things about another person, you do not have the right to think bad things about your brother and think negatively of him. What I mean is when one forms a solid idea and decides that another person is bad and evil. As for passing thoughts, they are forgiven. Thinking here refers to what one focuses on and is inclined towards. End quote. Ihya’ ‘Uloom ad-Deen and al-Adhkaar by an-Nawawi. 
And Allah knows best.