Wisdom speaks God’s mind in God’s ways, whereas folly is spoken from a position of personal offense with self-exalting motivations. Wisdom cannot come from a disposition of self-centeredness and neither can justice or fairness or upholding a standard that is outside of oneself. That standard appears in Ps. 37:31 as the law or teaching of God and that’s what occupies the heart of the righteous. That’s instead of dwelling upon all the injustices or spending mental energy scheming for pay back or wishing others harm. We know that out of the abundance of the heart the mouth speaks, so when God’s ways are permeating the heart then wisdom and justice will flow out.
This is why the Psalmist testifies in Ps. 119:10 With all my heart I have sought You; Do not let me wander from Your commandments. 11 Your word I have treasured in my heart, That I may not sin against You.
And in Ps. 40:8 I delight to do Your will, O my God; Your Law is within my heart.”
This is how one can have a firm footing and not slip into despair or destruction. Doing God’s will from the heart is always the safest choice for us, even if that invokes persecution, because we should much rather have man be opposed to us than God. As we have been seeing throughout this Psalm, being mistreated cannot be used as an excuse for sin. So when one is constantly reviewing God’s truth, God’s purposes and God’s prescriptions for our lives, then we will catch ourselves before we become too self-focused and act merely out of self-interest.