Note: This theory is not based on specific evidence or scientific study.
It certainly seems tenable to me, speaking both mechanically and as an observer of people (however little of that I may do) that there should be a correlation between what we think about, and in particular do, while exhausted or when we should be sleeping, and obsession, which I will define here as an irrational reappearance of a particular thought or topic in connection with unrelated events (perhaps a better word for psychologists would be fixation, but I'll stay with my terminology, if only because I am not a psychologist). I have two arguments in favor of this viewpoint, neither of them deductive nor scientific, if only (in the case of the first) for lack of sufficient or sufficiently detailed information to qualify as such. Both arguments are arguments for more research, and not arguments that the premise itself is valid.
The first argument is based on what I think I know about the function of the brain at night. We know that the brain does a great deal of integration of memories and other organizational and maintenance tasks within the brain during sleep. Supposing that this task starts earlier, when the brain begins to assume (based on internal factors) that sleep will be coming soon, it makes a logical kind of sense that if more stimuli (whether external or internal) are presented, with some probability, those stimuli will begin to be mentally associated with whatever memories, topics, or semantics the brain is currently integrating. That is to say, if you were playing baseball, today, and thinking at night about fluid mechanics at bedtime, you would be more likely to question the fluid mechanics behind a baseball pitch in the coming days than if you had studied it before dinner, and went straight to bed when you got tired--in the case of the sleepy studier, his current thoughts about airflow may have gotten misfiled as part of his thoughts about baseball, as his brain was categorizing his baseball-related memories from the day at the time he chose to study.
The second argument is not an argument at all, but rather an intuition pump. I will examine a number of cultures, however shallowly I may have observed them, and point out possible correlations which might be indicative of this relation. Examining my own (geek) subculture, I see two trends which may or may not be in correlation: people who spend their nights partaking in their hobby, and people who have become extraordinarily single-minded about such hobbies, such that the first thought they may have about any particular topic or event may be related to the hobby--for instance, seeing a cat stuck in a tree, a comic book geek's first thought might be about superman or another superhero rather than the fire department. Perhaps the best known example of this is the internet geek who instantly associates any attractive female with, we can only assume, the untouchable, airbrushed ladies of the internet who exist only to be looked upon by you, whatever they may be doing in picture or video to others. (This is not meant as judgmental--keeping in mind that I am proposing a reason for this instant and injurious mental reflex, and pointing out that it may not exist in every case, but that it explains such a case when and if it appears)
A second subculture might be what could best be termed the 'chatterbox' subculture--people who, whenever you see them, will continue speaking about anything that comes to mind until everyone within hearing range has bled to death through their ears. Supposing only that these people are those who habitually had late-night phone calls with each other, and that therefore they developed the nightly habit of talking about anything that came to mind, it is therefore possible that this habit could become a part of their daily ethic, if this imperative to talk becomes bound to the memory of everything they did during the daytime due to this unintentional contamination. This would, interestingly, be an example of such contamination not in explicit thought, but in compulsive behavior.
Similarly, we can ascribe similar compulsions to people who stay up late doing other things--reading, studying/memorizing, watching TV, drinking, or having sex, for example. Although a trivial counterexample of each case is likely (someone who does these things at night a few times but is not adversely affected), I would propose that it is more likely in every case for someone who is performing rote actions at night or before bed to become obsessed with such things that it would be if they exerted the same amount of effort during waking hours, such as in the middle of the afternoon.
This theory also has interesting ramifications for the study of, for example, depression. According to my proposal, people who are habitually depressive at bedtime are likely to become depressive more permanently, unless something else happens to break the association and/or create a new one. Similarly, people (such as myself) who consider the evening to be time during which to studiously avoid thought of work or anything not enjoyable may find themselves having trouble focusing on their work or other hard tasks even during working hours.
It also seems to be capable of explaining additional effects such as: the use of sleep deprivation as an act of torture or reprogramming, the stockholm syndrome, lovesickness (which is just another term for my definition of obsession, when defined by fixation upon a person rather than an act or idea), etc.
This hypothesis also seems testable and falsifiable, especially using the phrasing of the hypothetical consequences laid out previously, and I would be fascinated to know the results of such a study.