The new validation timing code is very smart about precisely when the last fully-validated ledger can be advanced. The call is here:
https://github.com/ripple/rippled/blob/check-accept/src/ripple_app/ledger/LedgerMaster.cpp#L784