That happened to me a long time ago. The only solution I found was to plug back the display and. Bring back the windows and panels that were in the other screen. Sucks, I know, but it's the only solution I could find. Eventually I just left the extra screen permanently plugged to the iMac.