You could register all undo actions with an object that will not be discarded. For example on the top level view controller, or even the app delegate, or a separate singleton. Then you would need to include in the object argument of registerUndoWithTarget:selector:object: enough information to apply the undo action on the appropriate sub view controller or its replacement.
If you just need to get actions targeted at the dead sub view controller out of the undo stack, call removeAllActionsWithTarget:self in the dealloc (or viewWillDisappear, or viewDidUnload, as appropriate) method of the sub view controller.