Dreams tend to be where our bodies take out the trash. You've been frustrated recently -- so your brain takes something 'old' (where you were young, facing less responsibility, more 'romantic' and he was "safe" because he was connected via your "best friend") and morphs it into an answer for the frustration you feel now.
Then you likely dwell on it subconsciously (or consciously) during the day so your mind turns to it again (kinda like a dog who learns a new behavior because it's easy and it "works" so DO IT AGAIN!!!).
Guilt produces its own kind of thrill -- and sometimes our minds like to venture in our sleep. I tend to control that kind of stuff -- I will change habits -- I will deliberately shun dangerous thots (thinking on a thing is where you birth temptation, to be honest) and it can breed even more dissatisfaction than you are already experiencing in your marriage. (Even if there is only an infinitestimal BIT of dissatisfaction, dwelling on it can cause more "dreams" as escapism -- and suddenly a 'BIT" can become 'more'.)
For me it would be time to drink some hot chamomile tea before bed (and bring the blood to the stomach rather than to the brain -- as my old general practitioner used to explain), make sure you stay away from sweets in the evening or anything else that might promote the same dreams to visit. Change some habits -- change what you read, what you listen to, etc. -- just to give your brain something a bit different to think about. Does that make sense??
For example -- I love romances ... BUT I will literally throw away a book if it's about a couple who "lie" to each other, or those books that romanticize infidelity. ugh. And if I really feel like I'm going thru a difficult bit, I've been known to drop back and go to the library and read 3-4 Grace Livingston Hill books in a row. JUST to re-route my brain *grin*. Talk about old timey!! And yet there is a sweetness in those old books.