We read that the Lord said to Moses Let me alone, to vent My anger upon them [Exodus 32:10a], and to Jeremiah, Therefore offer no prayer for these people nor stand in my path [Jeremiah 7:16]. By these words the Lord Himself makes it clear that the prayers of the devout set a kind of bridle on His wrath and check it from raging against sinners as fully as they deserve; just as a man who is willingly moved by his sense of justice to take vengeance can be turned aside by the entreaties of his friends and forcibly restrained, as it were, against his will.
Thus when the Lord says to one who is praying or about to pray, "Let Me alone and do not stand in My path," He forbids prayers to be offered to Him on behalf of the impious; yet the just man prays though the Lord forbids, obtains his requests and alters the sentence of the angry Judge. And so the passage about Moses continues: And the Lord repented and spared His people the evil with which He had threatened them [Exodus 32:14]. Elsewhere it is written about the universal works of God, He spoke, and it was [Psalm 33:9]. But in this passage it is also recorded that He had said the people deserved affliction, but He had been prevented by the power of prayer from carrying out His words.
Consider then the great power of prayer, if we pray as we are bidden, seeing that the prophet won by prayer what he was forbidden to pray for, and turned God aside from his declared intention. And another prophet says to God: In Thy wrath remember mercy [Habbakuk 3:2]. The lords of the earth should listen and take note, for they are found obstinate rather than just in the execution of the justice they have decreed and pronounced; they blush to appear lax if they are merciful, and untruthful if they change a pronouncement or do not carry out a decision which lacked foresight, even if they can emend their words by their actions. Such men could properly be compared with Jephtha, who made a foolish vow and, in carrying it out even more foolishly, killed his only daughter.
But he who desires to be a member of His body [Ephesians 5:30], says with the Psalmist I will sing of mercy and justice unto Thee, O Lord [Psalm 101:1]. Mercy, it is written, exalts judgment, in accordance with the threat elsewhere in the Scriptures: In that judgment there will be no mercy for the man who has shown no mercy [James 2:13]. The Psalmist himself considered this carefully when, at the entreaty of the wife of Nabal the Carmelite, as an act of mercy he broke the oath he had justly sworn concerning her husband and the destruction of his house. Thus he set prayer above justice, and the man's wrongdoing was wiped out by the entreaties of his wife.
Peter Abelard, in his First Post-Calamitatum Letter to Héloïse du Paraclet, trans. Betty Radice. Bolded emphases added.
Orat iustus, Domino prohibente, et ab ipso impetrat quod postulat et irati iudicis sententiam immutat.