You should see your doctor and have her/him do some simple tests to make sure your thyroid is functioning properly. The tests you need are Free
T4 and TSH - don't let them get by with just a TSH test, as that's not enough and doesn't tell the whole story. If your thyroid is under active, your metabolism also slows down and losing weight becomes, seemingly, impossible.
Both, sudden, unexplained weight gain and depression are prime symptoms of under active thyroid.