Have you ever done something and later realized that your actions had brought you a big bunch of troubles? There are always consecquences for sin. Sometimes they seem small and often they are quite large and not only affect us but those around us.
There isn't a sin listed here in this Psalm of David, but he seems to be saying that his problems are the result of God being angry with him for something he has done. According to my fancy Holman Christian Standard study Bible the early church fathers included this Psalm as one of the seven penitential psalms.
pen·i·ten·tial /ˌpɛnəˈtɛnʃəl/ adjective
formal : relating to the feeling of being sorry for doing something wrong : relating to penitence or penance
In other words, when you have sinned this is a good Psalm to say/pray/use as a means of confessing your sin and asking for forgiveness.
David asks for God to rescue him from his troubles (and from the consequences of his sin) based on God's faithful love.
This is the only way we obtain God's forgiveness and mercy - through His loving-kindness. Our sins are forgiven - not because of anything we have done (except to confess them) - but rather through the work of Jesus Christ.
The Apostle John worded it this way:
1 John 1:9 NASB
If we confess our sins, He is faithful and righteous to forgive us our sins and to cleanse us from all unrighteousness.
This is an echo of what David said in verse 9
The Lord has heard my plea for help;
the Lord accepts my prayer.