I agree the science is shit but is it not possible there is some fantastical 23rd century explanation that can be pulled out of a screenwriters ass here that fixes it? Something we didn't get to hear onscreen because they are too busy entertaining us instead?
The gravity generators blew a fuse and fecked everything up! Sending everyone flying all over the place! They drifted from the moon to earth because of Impulse maneuvering during the battle at 0.3c or some such technobabble bollocks. (though both ships are maneuvering at the same speed and relative to each other appear stationary)