you may get I-485 case had been denied (which is valid until the end of 30-day term) at the same time,
but when you submit the appeal within 30 days,
your case is pending and reopening, so your 485 is valid again until you got final denial of 140 appeal.
if you are successfull in appealing, your 485 is valid even you did not appeal for 485,
all 140 and 485 should be filed in the same USCIS Service Center.