In this section we'll look at a number of verses in the psalms that mention thanks, although that is not necessarily the theme of the whole psalm. The first group of psalms are psalms where the primary request is one of mercy, restoration, help, salvation, or deliverance.
In Psalm 6, in the context of asking for mercy, the Psalmist pleads with God on the ground that if he lives he can thank God:
Return, O LORD, deliver my soul: oh save me for thy mercies' sake. For in death there is no remembrance of thee: in the grave who shall give thee thanks?
Psalm 79 seems to be a psalm of the captivity. It speaks of the heathen defiling the temple. It mentions thanks and praise as the natural consequence of receiving forgiveness, help, and mercy from God.
O remember not against us former iniquities: let thy tender mercies speedily prevent us: for we are brought very low. Help us, O God of our salvation, for the glory of thy name: and deliver us, and purge away our sins, for thy name's sake. Wherefore should the heathen say, Where is their God? let him be known among the heathen in our sight by the revenging of the blood of thy servants which is shed. Let the sighing of the prisoner come before thee; according to the greatness of thy power preserve thou those that are appointed to die; and render unto our neighbours sevenfold into their bosom their reproach, wherewith they have reproached thee, O Lord. So we thy people and sheep of thy pasture will give thee thanks for ever: we will shew forth thy praise to all generations.
Psalm 35 similarly mentions thanks as the natural response to rescue from danger and destruction.
Lord, how long wilt thou look on? rescue my soul from their destructions, my darling from the lions. I will give thee thanks in the great congregation: I will praise thee among much people.
Psalm 69 mentions thanks in a similar context as well, namely salvation from poverty and sorrow.
But I am poor and sorrowful: let thy salvation, O God, set me up on high. I will praise the name of God with a song, and will magnify him with thanksgiving. This also shall please the LORD better than an ox or bullock that hath horns and hoofs.
In Psalm 140, David asks for deliverance from God. This psalm has a slightly more justice-oriented theme. The persecution of the wicked is unjust and the persecuted person is asking for justice to be done. This is a bit different from some of the previous instances where the Psalmist is simply asking for mercy. The outcome is the same, though: the righteous give thanks to the name of the Lord. Notice as well David's request: "redeem me, and be merciful unto me."
I know that the LORD will maintain the cause of the afflicted, and the right of the poor. Surely the righteous shall give thanks unto thy name: the upright shall dwell in thy presence.
Psalm 26 is a bit like Psalm 140, in that the context is thanksgiving for the righteous judgment of God. Psalm 26 takes things a bit further and suggests that David himself is just in God's sight. How so? By faith: "I have trusted also in the LORD; therefore I shall not slide." At some points in the psalm it sounds like David is asking to be judged based on his works. But when you look more carefully, you note David asking that he not be gathered with sinners or bloody man. Recall that David's sins are highlighted in Scripture.
< A Psalm of David.>
Judge me, O LORD; for I have walked in mine integrity: I have trusted also in the LORD; therefore I shall not slide. Examine me, O LORD, and prove me; try my reins and my heart. For thy lovingkindness is before mine eyes: and I have walked in thy truth. I have not sat with vain persons, neither will I go in with dissemblers. I have hated the congregation of evil doers; and will not sit with the wicked.
I will wash mine hands in innocency: so will I compass thine altar, O LORD: that I may publish with the voice of thanksgiving, and tell of all thy wondrous works. LORD, I have loved the habitation of thy house, and the place where thine honour dwelleth. Gather not my soul with sinners, nor my life with bloody men: in whose hands is mischief, and their right hand is full of bribes.
But as for me, I will walk in mine integrity: redeem me, and be merciful unto me. My foot standeth in an even place: in the congregations will I bless the LORD.
The last two examples are thanksgiving in the context simply of magnifying God. This sets them apart from some of the previous examples, which is why I've placed them last.
In Psalm 50, there are several different sections. One section outlines the message God has for his people, the immediately following passage outlines God's message for the wicked. In fact, while this psalm is not itself a call for deliverance, it does reference the fact that the thanksgiving may come after the deliverance.
Hear, O my people, and I will speak; O Israel, and I will testify against thee: I am God, even thy God. I will not reprove thee for thy sacrifices or thy burnt offerings, to have been continually before me. I will take no bullock out of thy house, nor he goats out of thy folds. For every beast of the forest is mine, and the cattle upon a thousand hills. I know all the fowls of the mountains: and the wild beasts of the field are mine. If I were hungry, I would not tell thee: for the world is mine, and the fulness thereof. Will I eat the flesh of bulls, or drink the blood of goats? Offer unto God thanksgiving; and pay thy vows unto the most High: and call upon me in the day of trouble: I will deliver thee, and thou shalt glorify me.
Psalm 119, the longest psalm, has one verse that explicitly mentions thanks. The psalm as a whole is a marvelous praise of the law of God. You will notice, however, that the thanksgiving is given at least somewhat in the context of mercy. The singer has been robbed, but he gets up at midnight to thank God and praises God as filling the earth with mercy.
Thou art my portion, O LORD: I have said that I would keep thy words. I intreated thy favour with my whole heart: be merciful unto me according to thy word. I thought on my ways, and turned my feet unto thy testimonies. I made haste, and delayed not to keep thy commandments. The bands of the wicked have robbed me: but I have not forgotten thy law. At midnight I will rise to give thanks unto thee because of thy righteous judgments. I am a companion of all them that fear thee, and of them that keep thy precepts. The earth, O LORD, is full of thy mercy: teach me thy statutes.