Background: we had a motivational lecture in our Kollel today, with a Rabbi praising virtues of studying Torah (towards Shavuos). He brought a couple of stories about prominent Rabbis dedicating their lives to the Torah study.
One story was about Rogatchover RabbiTnahks JoelK that learned Gemmorah while being Avel (in mourning), justifying it by Pikuach Nefesh for him.
That reminded me of some Mishnayos that talk of Rabbis that justified personal deviation from the accepted Halachah for themselves (e.g. Brochos 2,7 about Tavi the slave) (not to confuse with public decrees of עת לעשות לה').
When does a person reach that level of being allowed to deviate from the set Halachah, probably following the principle of "וְצַדִּיק בֶּאֱמוּנָתוֹ יִחְיֶה" (Havakuk 2,4)?