You already know the answer to this question. The pillow is a coping mechanism (like thumb sucking to a baby... and no I'm not calling you a baby). Coping mechanisms bring physiological/placebo effects to the people who use them. That's why they work.
It's not a certain guarantee that the dreams were caused by the removal of your personal coping mechanism but I bet there's a likely correlation between the two things.
Regardless of whether you continue using your pillow at night to help you cope with your loneliness and depression, you shouldn't expect it to be a cure-all. You need help beyond that coping mechanism. One day you just might find that sleeping with the pillow at night just might not provide the comfort it used to.
You need to get professional help. Someone to talk to. Talk therapy, antidepression meds, etc.... Seriously. Don't put getting help off for long.