If your 140 is denied before your H1B extension, I personally do think that your status turns back to H1B automatically (consult with your company laywer for that). Anyway, you can still work and turn back to H1B through an extension during appeal period. In case you give up all appeal means, the worst case is that you leave (go to the third country) and come back with a H-1B visa.
If you want to be worry-free, get a visa first