As St Paul once cried 'O wretched man that I am, who will deliver me of this body of death?' and who can forget Job's lament to God: 'I would choose strangling and death rather than my bones, I loathe my life; I would not live forever...'?
Take courage! You are in good company, and you have not lost the loving God who is always faithful and 'will never let you be tempted beyond your ability'.
Even the greatest saints were never rid of temptations and upsetting, even sinful, inclinations intruded into their hearts, and that sadly makes up part of life, for the enemy is always walking about seeking whom he may devour. They however, 'being rooted and established' in the love of God, felt distressed by these feelings and chose to resist them patiently clinging on to God's promises, until He finally called them from this world.
But these thoughts can be powerful. It may be worth asking yourself when these thoughts come upon you: how do they make you feel? What do you do in response? Are there some things in your life that make you think about ending it? How often and how long do these thoughts last?
Most importantly, if this is a frequent thing, it is ok to acknowledge that and seek professional help, if you can. If you want to be free of these thoughts and urges then it is not a failure of faith to be honest and acknowledge that and seek medical advice- it could very well be a means of healing that God wishes you to pursue.
I hope that helps a little; I know from my own experience how dizzying and confusing these thoughts can be, I often found talking about them with someone I trusted helped stop them getting too large in my imagination. Be assured I shall keep you very closely in my prayers!