Paul - you've asked a number of questions.
As to the real estate in the S-Corp - I'm assuming by your question that it is being sold - then the answer is yes the gain would be recognized inside the S-Corp and passed through to the shareholder. The shareholder could then take a distribution for the amount already taxed of the $15M (14.5Gain + .5Basis).
No if the property is distributed to the shareholder before the sale - the distribution is at FMV of $15M and taxed to the shareholder as a dividend.
I don't know about the liquidation of the corporation in the year of sale creating an offsetting loss. This sounds like a plausible idea, but you will need to have your tax preparer do some further research on this. The distribution of the $15M to the shareholder would bring the inside basis back down to zero or near zero - so a liquidation may be the answer.
If the property is not sold - I would leave the asset in the corporation and recognize (and document) the inside vs. outside basis of the shareholder.
Good luck -
Timothy J Folkers, CPA
Principal
Folkers, Choi & Associates
An Accountancy Corporation
18818 Teller Ave., Suite 109
Irvine, CA 92612
(949) 399-1040 ext 126 -Direct
(949) 399-1041 fax
Tim@FCA-CPA.com
www.FCA-CPA.com
TAX ADVICE DISCLOSURE
To ensure compliance with requirements imposed by the IRS under Circular 230, we inform you that any U.S. federal tax advice contained in this communication, unless otherwise specifically stated, was not intended or written to be used, and cannot be used, for the purpose of (1) avoiding penalties under the Internal Revenue Code or (2) promoting, marketing or recommending to another party any matters addressed herein.