The problem you are having is with the temperature sensor cable for the broken screen. When the screen is detached, the sensor port on the logic board registers a problem and in response the fans power to maximum and the system slows to a crawl. If you detach the sensor pad from the back of the broken monitor and adhere it to something like an installed metal hard drive case (leaving the other end plugged into its logic board port), the system will register temperate feedback - hopefully within the accepted heat range - and your headless iMac should work perfectly.