The gemara says that Shmuel Hakotton formulated the bracha of ולמשינים against the deviant צדוקים.
Why did Shmuel Hakotton specifically decree this bracha? [See Ayn Ayah on this gemara and Maamarei Pachad Yitzchak on Sukkos [78].]
To understand, we cite a Yalkut Shimoni [Shmuel 2/1] which expounds different words of the Song of Chana as the basis for the 18 brachos of shmone esrei:
ותתפלל
חנה ומכאן אנו למדים שנשים חייבות בתפילה, שכן
חנה הייתה מתפללת י"ח ברכות.
רמה קרני בה'
מגן אברהם.
ה' ממית ומחיה
מחיה המתים
אין קדוש כה' האל
הקדוש.
כי אל דעות ה' אתה חונן.
ונכשלים (בעונם) אזרו חיל הרוצה בתשובה.
מוריד שאול ויעל המרבה לסלוח.
שמחתי בישועתך גואל ישראל.
מקימי מעפר דל רופא חולים.
שבעים בלחם מברך השנים.
רגלי
חסידיו ישמור מקבץ נדחי עמו ישראל.
ה'
ידין אפסי ארץ אוהב צדקה ומשפט.
ורשעים
בחשך ידמו מכניע זדים.
ויתן עוז למלכו
בונה ירושלים.
We see that from the words ורשעים בחשך ידמו we learn to say the bracha to destroy the deviant Jews called ולמשינים that concludes מכניע זדים. In the sefer Mishbetzos Zahav [an excellent contemporary sefer on Navi] he asks a great question: The bracha of ולמשינים is NOT one of the 18 brachos of shmone esrei but the 19th bracha which was later appended to shmone esrei. He further asks that we don't find the bracha of על הצדיקים mentioned?
The Mishbetzos Zahav answers both questions in one shot: Originally the bracha against the reshaim was included in the bracha of על הצדיקים. We would daven for the tzadikim and against the reshaim in the same bracha. Afterwards Shmuel Hakotton in Yavne saw the proliferation of reshaim so he decreed that a separate bracha is mandated to be said against them. That is how we have one bracha on behalf of the tzadikim and another against the reshaim. This explains why the medrash [which refers to the period before Shmuel Hakotton] doesn't mention על הצדיקים and does mention ולמשינים which isn't even one of the 18 brachos. The reference to ולמשינים includes על הצדיקים and only afterwards the brachos were separated.
We learn that the basis of ולמשינים is rooted in the tfilla of Chana [which was said with prophecy - megilla 14a] that was said when she brought Shmuel to Shilo to serve in the Mishkan, but at that time that bracha was combined with the bracha on behalf of the צדיקים. Later when things got bad a new bracha was formlated against the reshaim.
We move forward. The gemara in Sanhedrin [11a] and Sotah [48b] teaches that Shmuel Hakotton was the only one in his generation who was a bit of a navi [see Rashi ד"ה אף הוא]. In Pirkei Avos [4/19] Rashi explains that Shmuel Hakotton was called "Kotton" in comparison to Shmuel Hanavi who was greater than he [him? Grammarians help] in nevuah. It is also implicit from Rashi there that the nevuah of Shmuel Hakotton was ROOTED in the nevuah of Shmuel Hanavi.
NOW we understand why specifically Shmuel Hakotton formulated the bracha of ולמשינים against the reshaim. The foundation of this bracha [as part of the bracha על הצדירקים] was already established in the nevuah of Chana that she said when she brought Shmuel Hanavi her son to serve in the mishkan. Shmuel Hakotton was uniquely qualified to decree a new bracha built upon this earlier bracha, because as we saw, his nevua was rooted in the nevuah of Shmuel Hanavi.
והדברים נפלאים פלאי פלאות
[Based on the sefer Marbeh Bracha Simman 54 by my teacher Rabbi Yaakov Dovid Homnick Shlita]