Your mood has a strong effect on your health - stress is a huge source of deaths in the US (probably the largest by far but I have no studies to link). If a half a cup of ice cream significantly improves your mood and takes you out of depression then yea - it's probably pretty good. Please also be aware that if we're discussing the American diet there are plenty of folks who drink coke like water - ice cream has a pretty equal amount of sugar by volume of coke and the lack of excessive amounts of sodium means that there's less of a drive to over consume it.
Sweets eaten in reasonable quantities can be part of a healthy diet to maintain weight - though generally for weight loss you'll want to cut out as much sugar as you can or find better sources for it since our bodies are terrible at processing it.
1. https://www.coca-colacompany.com/au/brands/coca-cola 10.6g per 1/2 cup (ish) vs. https://smartlabel.unileverusa.com/077567274731-0001-en-US/i... - 19g per 2/3s of a cup