Let's be accurate at least: Q is not a gnostic gospel, nor has ever been declared heretical. It was purely a hypothesis that there was a common sayings source used by Matthew and Luke (apart from Mark which predated them). Q is just short for Quelle which is German for "source".
Mike