As always, this advice is worth what you paid for it, but here goes.
I'm a really heavy sleeper so I seldom dream (more correctly I don't remember them) but I often have trouble falling asleep. Here are some thoughts to try & keep the demons at bay so you can get a good night's rest:
1. A natural sleep aid like St. John's Wort or Valerian Root (my favourite).
2. A white noise generator (like those things that play ocean sounds, etc).
3. I know it sounds silly but if I'm desperate I count breathes (in 2,3,4,5 - out 2,3,4,5)
Another thing might be books on tape (from your library or check out audible.com). I don't like falling asleep to them as I always lose my place
but sometimes I listen to "golden oldies" on my headphones as they are "soothing" and don't engage my mind to keep me awake but do keep me from reviewing the day, etc.
I don't know the backstory but would constructing mental scenarios where your ex gets her comuppance help (or make things worse
Hope this helps and we are sending good thoughts your way!