Azerbaijan thwarts 'terror attack'