Prplchknz,
Been there with the looping thought, if not the exact situation. The first priority for me is usually to break the thought pattern. There have been some excellent suggestions by other posters. For me I just have to get moving, do something, make a first step....talking with others sometimes increases the loop feedback for me, especially if they play on my fears, so doing something physical works for me. Even just changing your environment for a bit (which you have worked out) works.
For me, when I get into circular thought, it means I can't see forward so I need external input. It also means I stand still when I should be pushing forward, so I quite literally have to force myself into thinking forward, and seeking new input.
The thing is circular thinking, depression, insomnia etc, are all related (for me at least), it's taken me most of my twenties to learn not to fall into those patterns, and part of that was cutting out negative people in my life (my mother who utilised my thought patterns against me, her way of controlling me,and came pretty close to driving me to suicide). The biggest thing I've learnt, is that it's all up to you, and the choices you make. Don't beat yourself up about the things that didn't work out (other people make their own choices too), and it is part chance, but for the things within your reach, it is standstill and live in past, or move forward and reach for the future.
Keep your eyes on the bigger picture, everything passes even grief and loss.