Doesn't work that way.
Frankie was #1 after beating BJ despite having an unavenged loss to Maynard who had yet to lose.
Rampage would have been #1 had he beaten Jones in 2011, despite having a loss to Rashad who beat him a year prior and hadn't lost since then.
Say Overeem wins but doesn't get a title shot for whatever reason (injured, Cain is injured and he doesn't wait, elects to fight JDS instead), if Werdum fights for and wins the title he would be ranked as the #1 HW despite losing to Overeem who hadn't yet lost.
I think the only cases I know of in recent history where a guy didn't get bumped to #1 after beating the #1 ranked fighter is Werdum (Brock was ranked #1 instead) & Forrest (Rampage got ranked #1), both of those cases were someone outside the top 5 however.