A simple fix for the Knowledge of The Borg continuity problem is that Starfleet Command knew about The Borg back when the Elaurians where attacked, but kept them a secret to prevent panic and because they didn't consider them a serious threat. The Hansens belived the rumors of The Borg and set out to find them. What they discovered never made it back to the Federation so The Borg were still just a rumor to most people. Later the Romulans and Federation began to mysteriously lose colonies on their corewise borders which was heavily hinted to be due to The Borg. Finaly in Q-who Starfleet was forced to acknowledge the existance of the Borg, but to avoid embarassment, they pretended that this was the first that they knew of them. Not the most Federation like behaviour but that can always be blamed on Section 31.