A major police investigation is under way into a social media threat against a recently opened western Sydney mosque alluding to a terrorist attack.