No. In both cases Space Cannon did not destroy the last ship in the system, so the objective is not fulfilled.
The official FAQ says the objective is not scored if Direct Hit destroys the last ship, or if fighters are later removed for lack of capacity, because those ships were not destroyed by the Space Cannon ability.
Official FAQ (LRR v2.0). Use the cited official wording or card printing; do not mix replacement / Omega / expansion versions.