Do you have a topping lift that operates the same as your halyard?
If so, you can fasion a fishing tool(be creative, coathangers are an excellent source of material, so is spare meccanno) Hook it to the topping lift ALONG WITH A RETRIEVAL
LINE/DOWNHAUL! and then hoist it up and swing it about attempting to wrape the open end of the "hook" around the dangling main halyard. Not that hard to do, though you may end up re-bending your fishing gizmo a couple of times. Once you have "caught" the halyard, release the rope clutch on the main and pull down the downhaul. The fishing gizmo will lside alkong the main halyard till it hits the loop/shackle at its dangly end and then you will be able to gently pull down both topping lift and trapped main.
Simple.
Sasha