The Torah tells us that one his way down to Mitzrayim, Yakaov stopped to offer korbanos "Elokei aviv Yitzhak," the G-d of his father Yitzchak (46:1). Why did he single out Yitzchak? Why not "Elokei avosav," or "Elokei Avraham v'Yitzchak?" (see Rashi)
Yitchak represents the midas ha'din. Ya'akov had suffered for so many years and through so many sorrows, the culmination of which was the loss of Yosef. He was certainly familiar with din and mishpat. Suddenly he discovers that Yosef is alive, that he is a leader in Egypt, that the family will be safe. What he had seen as punishment had in fact been rachamei Shamayim. Suddenly, he has a completely different perspective on what din is all about, and so he turns, "l'Elokei Yitzchak," to offer korbanos in appreciation for that midas ha'din, which was really rachamim in disguise.
The Navi tells us "Tzom he're'vi'i v'tzom ha'chamishi..." will become days of "sason v'simcha," days of rejoicing. Chasam Sofer (Toras Moshe, end of Vayigash, d"h "v'yiten") explains that it doesn't mean that Hashem will take away the fast days and we will forget all about them and that's why we will be happy. It means that the fast itself will bring us rejoicing. So long as we fast and pray, so long as Hashem inspires us to fast and pray, it means we have a connection to Him. That connection itself is a sign of rachamei Shamayim, that we are not forsaken even amidst the galus. Like Ya'akov Avinu, we will one day look back and give thanks and celebrate even the midas ha'din.