Psalms 38 – 39 both speak of sin in the Psalmist’s life that has, because of the hand of God, left him debilitated and in despair. Because of its appearance after those two, Psalm 40 would seem a hymn of rejoicing that God has answered him and forgiven him.
What leads from a muddy pit of despair to the firm footing of a rock?
The writer says it is God’s adoption of his life and he frames it in an odd way (unless we remember an obscure passage from the law): “my ears you have pierced” (verse 6).
Under the law, one might buy a Hebrew servant and work him for six years. But in the seventh year, he was to go free. But the servant might have, in the intervening six years, become so close, or perhaps so dependent, as to not want to leave, but to remain a part of his master’s family. In that case, he might allow his master to pierce his ear with an awl, a forever sign that the master had accepted him as a part of his family and brought him under the eternal protection of his house.
This is what the Psalmist is saying: His situation changed when he confessed that he wanted to come under the house of God, live in His refuge and in His service. At that point, from a quicksand of sin, his life was rescued by God.
So too we must decide that the life we’ve been determined to live, causing us so much pain, is simply not the one for us. We want to come under the refuge of God, and be His servant and not our own for all our days. It is then that we can find deliverance and forgiveness.