John Piper, Future Grace:

There are ways that gratitude helps bring about obedience to Christ.  One way is that the spirit of gratitude is simply incompatible with some sinful attitudes.  I think this is why Paul wrote, “There must be no filthiness and silly talk, or coarse jesting, which are not fitting, but rather giving of thanks” (Ephesians 5:4).  Gratitude is a humble, happy response to the good will of someone who has done or tried to do you a favor.  The humility and happiness cannot coexist in the heart with coarse, ugly, mean attitudes.  Therefore the cultivation of a thankful heart leaves little room for such sins.

There is a sense in which gratitude and faith are interwoven joys that strengthen each other.  As gratitude joyfully revels in the benefits of past grace, so faith joyfully relies on the benefits of future grace.  Therefore when gratitude for God’s past grace is strong, the message is sent that God is supremely trustworthy in the future because of what he has done in the past.  In this way faith is strengthened by a lively gratitude for God’s past trustworthiness.