Try putting this code in the - (void)viewDidAppear:(BOOL)animated method of your MainViewController.
[self.view.superview insertSubview:self.view atIndex:0];
Actually I was facing exactly same issue, as u described. And after research I found that, all the view hierarchy still exist in the memory, but mainViewController's view become the topmost view (Hiding others.). I do not have any logical explanation, why it is happening. I will post the details if I found any explanation.