Let $A$ be any vector field, then by Stokes Theorem we have:
$$ \oint_{\gamma} \mathbf{A} \cdot d \mathbf{r}=\int_{S} \operatorname{curl} \mathbf{A} \cdot d \mathbf{S} $$
We can now apply Divergence Theorem to $\operatorname{curl}\mathbf{A}$, which using the fact that divergence of curl is $0$, gives:
$$ \int_{S} \operatorname{curl} \mathbf{A} \cdot d \mathbf{S} = \int_{\tau} \operatorname{div} ( \operatorname{curl} \mathbf{A} ) d \tau = 0 $$
So we could conclude for any vector field $A$:
$$ \oint_{\gamma} \mathbf{A} \cdot d \mathbf{r} = 0$$
What is wrong here?
Your second equation is the reason for such a discrepancy: $$ \int_{S} \operatorname{curl} \mathbf{A} \cdot d \mathbf{S} = \int_{\tau} \operatorname{div} ( \operatorname{curl} \mathbf{A} ) d \tau = 0 $$
Here you combined Stokes' theorem with the three-dimensional divergence theorem, remember that the divergence theorem is only applicable on "closed surfaces" meanwhile the surface obtained from stokes theorem is usually not closed in three-dimensions, except for very special cases in which your statement holds true.