There's no need to leave country. Your H1 is still valid even if you've used AP to enter. H and L visas are exceptions to the general AP rules. Read on INS web site or murthy.com. In your example of 485 being denied, your H1 will keep your status. Of course it should be with valid time frame and same employer.