You don't have to do anything especially worthy to create or deserve self-esteem; all you have to do is turn off that critical, haranguing, inner voice.
If you're self-compassionate, you'll tend to have higher self-esteem than if you're endlessly self-critical. And like high self-esteem - self-compassion is associated with significantly less anxiety and depression, as well as more happiness, optimism, and positive emotions.
You're human. You'll screw up. Denying that is crazy. Forgiving yourself has all the benefits of self-esteem without making you a narcissist that's out of touch with reality.
Negative thinking patterns can be immensely deceptive and persuasive, and change is rarely easy. But with patience and persistence, I believe that nearly all individuals suffering from depression can improve and experience a sense of joy and self-esteem once again.