David didn't do it because he thought his acts would save him. He didn't think think they would.
He praised God because it was the right thing to do - because God is worthy to praise... and the One we should always follow. David knew that following God was right, even if he never got the blessings that he wanted so much.
But if King David could make the decision to follow God even though he believed that it would never be enough, and the result was the Psalms and a life full of beauty and goodness... then I could do the same, right? Even if I never made it to Heaven, I could still serve God. That's what brought me peace.
That will likely be one of the most difficult aspects of your life.
Is it fair? Is it fair to be born in a situation where you have no control?
Fairness is something you'll probably grapple with in your life. I know I did. How could God really be fair if some children were born to starve in Africa and others were born on the side of the street and others were born into happy, loving families? Was it fair to be born with physical or mental or social disabilities that would make life excruciatingly painful for as long as you lived? How could a perfect God bless one innocent child with everything, while essentially cursing another just a few doors away?
In your case, there are lots of questions of fairness. Was your upbringing, birth, early childhood, school, Church, and everything else fair? Is it fair for you to have to wait an extra 10 years, leave your home, and denounce part of your family's relationship to be baptized?
It took me a long time to come to grips with how God really sees our circumstances in life. He would love to be able to bless us. But He loves us too much to make life easy. So He adds in things that are hard. Things designed to honestly make us question who we are. And sometimes things that seem totally and completely unfair, with the hope that we will trust Him, believe Him, and commit to following His commandments no matter what. Abraham was promised infinite posterity through his son Isaac. Then he was commanded to sacrifice Isaac on a mountain. A dead son can't get married or have children... so Abraham didn't know how God would keep His promises. But he chose to believe anyway... and because he found that strength and faith deep inside him, God could bless him with everything. An easier life doesn't mean a happier life.
That's not to say that everyone should have the same trials and blessings. Don't mix up equality (where everyone has the exact same life circumstances) with fairness (where everyone has exactly what they need). God chooses the best circumstances for each of us that will push us beyond our limit... and, because of that, everyone's life is different. Ironically, that's how life is fair - because it's individual. Follow God, and everything will always be ok. He will never let anything happen to you that could destroy your soul - on the contrary, He'll come up with some of the most creative ways to always show you He is there and to push you to become the person He sees in you.
I would be far less today if God had just taken away the obstacles in my life. I'm grateful for the crazy, seemingly unfair, and often absurd circumstances that life has thrown at me, along with the lessons I've learned from them. And you'll find, if you stick close to Him, that the same is true for you.
May God be with you, little brother. I'm here for you if you need a friend to talk to.
A good link:
A post written by a Mormon woman raised by same-sex parents