As a new (6 months) parent, I can confirm anecdotally that lack of sleep profoundly messes with the brain. Even getting your normal duration of sleep, but punctuated with lots of short waking periods, makes it almost impossible to function in highly demanding intellectual tasks for any length of time.
And if you have any underlying mental issues (hint: you do), you better believe those are coming to the surface when you've been chronically sleep deprived for 3 months.
Long story short: for the love of all that is good, sleep well. If there's something stopping you, find a way to get help or get away for a while so you can get some real sleep. The ability to think properly comes back remarkably quickly after a good sleep.