Trying to commit suicide is a mental disorder if it's due to depression and alike. But- Is there a medical disorder where one wishes to be dead, without ever taking action (i.e. doing harm to oneself). Is that still classified as depression?
Self-harm is not a mental illness, but a behavior that indicates a lack of coping skills. Several illnesses are associated with it, including borderline personality disorder, depression, eating disorders, anxiety or posttraumatic distress disorder.
Sometimes when people self-harm, they feel on some level that they intend to die. Over half of people who die by suicide have a history of self-harm.
However, the intention is more often to punish themselves, express their distress or relieve unbearable tension. Sometimes the reason is a mixture of both.
Self-harm can also be a cry for help.
So the thought of wishing oneself dead could be construed as a symptom of depression, but cannot be classified as depression until a professional takes a closer look at the individual's life, behavior, and thought patterns.
This is because the thought of self-harm might be, in a way, self-harming already, which may be a way to feel control, release, or some particular stimulus, or it could be the initial stages of depression, or so on. The ambiguity can also be witnessed in all the comments going back in forth in the OP's question.
Therefore, it's a complicated area, extremely broad, but with a general consensus in one area: best to consult a professional or someone trusted to gain more information and insight into the matter.