This is exactly how I get out of depressive or anxious periods. Somehow the clarity of lying in bed being as painful as getting up hits home and whoop you're on your way out of the slump.
This does not work on all people though, I know of one person who's been resistant to medication, meditation, therapy.. none of it seems to truly change thought patterns. It just keeps coming back time after time.