The important thing is that he learned to love himself and fin his self worth. Masahiro loved him but made sure that he felt that he was worth loving before taking it farther. Depression makes you feel like you are a waste but you are not. Everyone has a worth and being able to find that worth and see it is the beset way to combat depression, tough it can be extremely difficult to see for yourself at first. Having supportive people who love you in your life can really help, but finding a lover will not save you from depression. There's a lot of work and self discovery involved and it's not fair to a significant other if you try and push all that work and expectation onto them. In the case of this story Masahiro gave him a safe place to go and that started the process, but Haruhi did a lot of introspection and work on his own. Haruhi getting together with Masahiro was just the cherry on top of his self examination and work.
I wish someone would save me like how Haruhi was saved. I know the feeling of depression, wanting to self destroy and standing at the edge of something dangerous....