The New Testament suggests that thanksgiving and praise are matters of your will, not your emotions. When trouble leads to discouragement and discouragement to depression, the last thing that you might feel like doing is to lift your face towards heaven and praise the Lord for anything, right?
The first step in breaking through the gloom of your difficulty is to understand that what you are doing is right, not necessarily what makes you feel good. Do it in simple, straightforward obedience to Scripture that says, "Give thanks in all circumstances, for this is God's will for you in Christ Jesus" (1 Thessalonians 5:18).
Second, you will never be so far removed from God that you cannot focus your thoughts on the character of God and say, "Thank you, Lord, for who You are and what You are." Far too much of our relationship with God is experience-oriented. We praise God when we feel happy and things are going smoothly. But in prison, Paul and Silas sang praise to God. David, the psalmist, knew what difficulty and trouble are about, yet he said, "I will bless the Lord at all times; His praise shall continually be in my mouth" (Psalm 34:1 KJV).
Faced with trouble, it is easy to forget that He loves you. But if you have made the decision to give thanks, begin to quietly do so, knowing His love is both constant and unchanging. It isn't necessary to thank God for those things that you know clearly were not God's will or purpose for your life, yet you can thank Him that He can still take the fractured, broken pieces and put them together again. He knows your pain and hurt, and no matter what happens - He is bigger than the need that confronts you.
I will praise the Lord, who counsels me; even at night my heart instructs me. PSALM 16:7