The Shulchan Aruch in 47/1 says
One who thinks about words of Torah does not need to say the blessings [of the Torah]. Similarly, one may pasken without giving the reason
The Mishna Berurah explains why one may pasken
for the reason for the halacha - which is the most important part - is just being thought about [and not verbalized]
The Mishna Berurah brings the Gra who says
this is no better than reading - for which one does have to say the blessings of the Torah, and even in thinking, one has to first say the blessings of the Torah
My question is not about the propriety of whether one can think in Torah before saying the blessings of the Torah. The posek I use says it is permitted, and one does not need to be strict like the Gra, especially if one wakes up in the middle of the night and has a Torah thought - one does not need to banish it. However my chavrusa's posek does pasken like the Gra, and I have heard that Rav Chaim Kanievsky will only think of names of Tanaim and Amoraim in such a situation.
My chavrusa claims that the reason that his posek paskens like the Gra is because of a "rule" in learning Mishna Berurah, that when the Mishna Berurah quotes the Gra as he does above (matter-of-factly and not as a dissenting opinion) then he is actually paskening like him.
I am interested in finding out more about such a rule.