Yevamos 90b: One may listen to a Navi even if he tells you to transgress a mitzvah in the Torah, like Eliyahu on Mount Carmel. This proves that the Sages have the power to permit a sin! – There is it different because the Torah says, “To him you shall listen.” But why not generalize from there? – There it was different because Eliyahu needed to stand up against the sin [of idolatry].
Tosafos: How could we have learned it out from a Navi? Maybe a Navi is different because Hashem told him to do it. The Ri answers: to permit the sin, prophecy would not help. He is only using his prophecy to know that the plan will be effective – in Eliyahu’s case, that fire would come down from the sky on the mizbeach.
יבמות צ ע”ב: ת״ש: (דברים י״ח) אליו תשמעון ־ אפילו אומר לך עבור על אחת מכל מצות שבתורה, כגון אליהו בהר הכרמל, הכל לפי שעה שמע לוִ שאני התם, דכתיב: אליו תשמעון. וליגמר מיניהִ! – מיגדר מילתא שאני.
תוס’ ד”ה וליגמר מיניה. וא״ת שאני התם דעל פי הדבור היה מתנבא לעבור והיכי נגמר מיניה לעבור משום תקנתא דרבנן שלא על פי הדבור ונראה דכיון דעל פי הדבור שרי משום צורך שעה הוא הדין שלא על פי הדבור שהרי אין נביא רשאי לחדש דבר מעתה וכו’ ואר״י משום דאיתחזק בנביאות היו סומכים עליו במה שהיה מבטיח בירידת אש ושוחטים על הבטחתו קדשים בחוץ שבזכותו ותפלתו תרד אש מן השמים ויהיה מיגדר מילתא שיתקדש שמו של הקב״ה ברבים וע״י כך יחזרו ישראל למוטב.
When Rabbi Shmuel Berenbaum, the Mirrer rosh yeshiva, was sitting shiva for his son R’ Leibel, people told him stories about miraculous recoveries and yeshuos people had experienced through R’ Leibel’s brachos and tefillos. Reb Shmuel listened the entire time quietly. Someone pressed him to express his opinion on such things, and he said, “Nu, he learned so much Torah – it could be true.”
R’ Yosef Simcha Klein, his grandson-in-law, noted that the same was true of Reb Shmuel himself: When he was niftar, many people came during shiva and told stories about how every blessing and promise he gave had come true.
The source for the idea that learning Torah enables one to perform miracles is the Tzidkas Hatzadik (72), who says that Moshe Rabbeinu performed his miracles through learning Torah. (This could be based on the Pesikta brought in the Yalkut on Parshas Chukas, which says that when Hashem told Moshe to speak to the rock, He meant that Moshe should teach Torah in front of the rock, and it would give water – see Emek Hanetziv, Matos 5.) The Tzidkas Hatzadik also says that Eliyahu performed the miracle of bringing down fire from heaven through the power of the chiddush in halacha that he was mechadesh to permit offering a korban outside the Beis Hamikdash.
R’ Yosef Simcha adds that there were two other reasons why Reb Shmuel’s words came true. The first was he felt the pain of others exactly like his own. The Shem Mishmuel relates (Beshalach p. 206) that his father, the Avnei Nezer, once told him, “Anyone can save his friend through his prayer, but only if his friend’s pain touches him to the depths of his heart. This is not easy and only someone on a high spiritual level can fulfill this condition.”
The second was that he was careful with his speech. As R’ Elchonon writes (Kovetz Shiurim Kesubos 208, on daf 62b), we find stories in the Gemara where someone died because a tzaddik suggested that they might be dead, כשגגה שיוצא מלפני השליט. Normally, Hashem fulfills the blessings or curses of a tzaddik because “He does the will of those who fear Him” but in these cases it was not the tzaddik’s will at all. Rather, it is because the speech of someone who guards his tongue is like a sharp axe, which can cut even accidentally. By the same token, his blessings are fulfilled. But when someone does not guard his speech, it is like a dirty and rusty blade that cannot cut.