The dreaming part is a subconscious thing, so for that part of your question, I would say no. However, the "thinking" part can be more complicated.
First, it truly depends on what thoughts a person is having. Many believe that cheating starts in the mind. Before there is ever a kiss, a touch, there was a thought. Sometimes, even though a person is attached, it is certainly normal to think about or fantasize about someone else. After all, we are only human. The important thing to consider is: How strong are the thoughts, and how far would they possibly take someone?
If said thoughts do not cause a person to act, then I'd say it isn't cheating. If, however, the thoughts are persistent desires, then trouble could be ahead.