The Enterprise is near Earth and a Borg sphere travels back in time to a period before the Enterprise and the federation itself existed.
Almost immediately the entire earth changes to a Borg populated planet.
If the Borg went back and assimilated the Earth before the Enterprise existed and borgified (I know assimilated) all of mankind, the Enterprise should have disappeared immediately as it would have never been created.
Evidence of this in the STU would be the TNG episode "Yesterday's Enterprise." In the episode the Enterprise C comes through a rift bringing it into it's future to the 24th century (the time period of TNG). Because the Enterprise C's defense of a Klingon outpost was vital to forming an alliance between the Klingons and the Federation at the Battle of Narendra III, that alliance was never formed and the federation was now at war with the Klingons. In an instance the Enterprise and everything about the timeline has changed (heck Tasha's on the bridge). Picard sent the Enterprise C back into the rift and as soon as it went back to it's original time in the Enterprise D's past and fulfilled it's mission the timeline reverted back. It happened instantaneously, as soon as it cleared the rift the Enterprise D had their regular uniforms, compliment, etc. back.
In TNG Tapestry, I know it's Q time travel so don't just focus on this one, Picard goes back to his youth. When he doesn't get into a fist fight as a young cadet he ends up not being a risk taker. When Q brings him back into his time, he's a low level officer, not even command rank.
In TNG Firstborn, future Alexander (K'mtar) travels back from the future trying to change his young self into a warrior so that Worf won't die as soon as he does in the future. Eventually K'mtar wants to kill his younger self for being such a wuss. He fails as Worf catches K'mtar. Worf says that Alexander has already changed history by coming back in time. Things may not at all happen the way Alexander fears, and when he returns to his own time he may well find Worf alive. K'mtar says that he has failed, because the boy he was remains the same. Worf says that Alexander is the same, but Worf has changed, and now he understands that Alexander will have a noble future even if he is not a warrior. K'mtar embraces him and says, "I love you, father." Worf replies, "And I you, Alexander." So both K'mtar (future Alexander) and Worf acknowledge that changing the past affects the future, so much so that Worf states that when he gets back to the future (pun intended) Worf may be alive and well.
If a change is made in the past it affects the present and future. Why in the movie First Contact didn't the Enterprise disappear as soon as the Earth was assimilated in Earth's past?
(I awarded a correct answer as it is an in universe answer, however if anyone can further expound on that answer I'd appreciate it. I understand that Data was a bit puzzled so there probably isn't an answer, but it seems that if the Enterprise were never created, a wake, rift, temporal, or otherwise wouldn't protect them.)