בתר דשקלינהו למזייה לבשינהו למאניה אמר ליה סק ורכב אמר ליה לא יכילנא דכחישא חילאי מימי תעניתא גחין וסליק כי סליק בעט ביה אמר ליה לא כתיב לכו (משלי כד, יז) בנפל אויבך אל תשמח אמר ליה הני מילי בישראל אבל בדידכו כתיב (דברים לג, כט) ואתה על במותימו תדרוך (אסתר ו, יא)
After Haman trimmed his hair, Haman dressed Mordecai in the royal garments. Haman then said to him: Mount the horse and ride. Mordecai said to him: I am unable, as my strength has waned from the days of fasting that I observed. Haman then stooped down before him and Mordecai ascended on him. As he was ascending the horse, Mordecai gave Haman a kick. Haman said to him: Is it not written for you: “Do not rejoice when your enemy falls” (Proverbs 24:17)? Mordecai said to him: This statement applies only to Jews, but with regard to you it is written: “And you shall tread upon their high places” (Deuteronomy 33:29).
א"ר אחא בר חנינא (משלי יא, י) באבוד רשעים רנה באבוד אחאב בן עמרי רנה ומי חדי קודשא בריך הוא במפלתן של רשעים הכתיב (דברי הימים ב כ, כא) בצאת לפני החלוץ ואומרים הודו לה' כי לעולם חסדו ואמר רבי יונתן מפני מה לא נאמר בהודאה זו כי טוב לפי שאין הקדוש ברוך הוא שמח במפלתן של רשעים דאמר ר' שמואל בר נחמן אמר ר' יונתן מאי דכתיב (שמות יד, כ) ולא קרב זה אל זה כל הלילה באותה שעה בקשו מלאכי השרת לומר שירה לפני הקב"ה אמר להן הקב"ה מעשה ידי טובעין בים ואתם אומרים שירה לפני
Rav Acha bar Chanina said: “When the wicked perish, there is song;” [thus] when Ahab ben Omri perished here was ‘song’. But does the Holy One, blessed be He, rejoice over the downfall of the wicked? Is it not written, [That they should praise] as they went out before the army, and say, “Give thanks unto the Lord for His mercy endures forever;” concerning which R. Yonatan asked: Why are the words, “He is good” mitted from this expression of thanks? Because the Holy One, blessed be He, does not rejoice in the downfall of the wicked. For R. Shmuel bar Nahman said in R. Yonatan‘s name: What is meant by, “And one did not come near the other all night?” In that hour the ministering angels wished to utter the song [of praise] before the Holy One, blessed be He, but He rebuked them, saying: My handiwork [the Egyptians] is drowning in the sea; and you recite a song before me!
There were these hooligans in Rabbi Meir’s neighborhood who caused him a great deal of anguish. Rabbi Meir prayed for God to have mercy on them, that they should die. Rabbi Meir’s wife, Berurya, said to him: What is your thinking? On what basis do you pray for the death of these hooligans? Do you base yourself on the verse, as it is written: “Let sins cease from the land” (Psalms 104:35), which you interpret to mean that the world would be better if the wicked were destroyed? But is it written, let sinners cease?” Let sins cease, is written. One should pray for an end to their transgressions, not for the demise of the transgressors themselves. Moreover, go to the end of the verse, where it says: “And the wicked will be no more.” If, as you suggest, transgressions shall cease refers to the demise of the evildoers, how is it possible that the wicked will be no more, i.e., that they will no longer be evil? Rather, pray for God to have mercy on them, that they should repent, as if they repent, then the wicked will be no more, as they will have repented. Rabbi Meir saw that Berurya was correct and he prayed for God to have mercy on them, and they repented.
(יט) שְׁמוּאֵל הַקָּטָן אוֹמֵר, (משלי כד) בִּנְפֹל אוֹיִבְךָ אַל תִּשְׂמָח וּבִכָּשְׁלוֹ אַל יָגֵל לִבֶּךָ, פֶּן יִרְאֶה ה' וְרַע בְּעֵינָיו וְהֵשִׁיב מֵעָלָיו אַפּוֹ:
(19) Shmuel the Younger says: (Proverbs 24:17-18) "When your enemy falls, do not be happy, and when he stumbles, let your heart not rejoice. Lest God see and it be bad in His eyes and He turn from him [the enemy] His anger."
Rabbi Shai Held
The ideal and the best case scenario is for the wicked man who is ill to have both his body healed and his soul transformed. When that seems impossible (say, because the person in question has a truly intractable personality disorder), then I think it best to pray that Hashem do whatever Hashem deems necessary to prevent the wicked person from enacting his wicked plans, or from (further) damaging and endangering others. We should not dictate to Hashem the means of salvation Hashem will use; we should only pray for the salvation and leave those decisions in God's hands.