More details on the tank and its inhabitants please.
What type of fish is afflicted? In addition, please describe what is wrong with the fish to the best of your ability (i.e. cotton like growth, bloated, etc.).
What are your tank parameters (ammonia, nitrites, nitrates, temp, pH)? Please give exact values.
How large is the tank? How long has the tank been set up?
What type of filtration are you using? Please give the name and number (i.e. Fluval 304) and amount of*gph*if known.
How many fish are in the tank? What kinds of fish are they and what are their current sizes?
When is the last time you did a water change and vacuum the gravel? How often do you do this? How much water do you remove at a time?
How long have you had the fish? If the fish is new, how did you acclimate it/them?
Have you added anything new to the tank--decor, new dechlorinator, new substrate, etc.?
What kind of food have you been feeding your fish, have you changed their diet recently?
I highly doubt that a fish has sufficient brain function to deliberately kill itself because it misses its pal. They might get stressed about it which causes other issues and they die of those other causes, but your fish didn't commit suicide. It has no concept of death or killing itself. Fish function on instinct, if it jumped onto the filter or whatever it did it was probably doing this for a reason.
What could be happening is poor quality or some other issue with the tank. Perhaps it was hanging round the filter because the water was cleaner there. Poor water quality is a common cause of fish jumping. They dont know there is no water on the other side of the glass and are just trying to find somewhere they think might be better to live.