The scaling relation $\alpha = d \nu-2$ is in fact a hyperscaling relation, which is valid only below the upper critical dimension (as always, right at the upper critical dimension, here $d=4$, there are logarithmic corrections to the scaling law, so the hyperscaling relation is not really true).
This relation can be obtained by some RG arguments for the flow of the free energy. After rescaling lengths by a factor $s$, one obtains
$$
f(\tau,u)=s^{d} f(\tau s^{1/\nu},u s^{-y}),
$$
with $y>0$ the lowest irrelevant critical exponent. Here $u$ is an irrelevant operator (related to the interaction in a $\phi^4$ theory).
Choosing $s=\tau^{-\nu}$, we get ($F(x)=f(1,x)$)
$$
f(\tau,u)=\tau^{\nu d} F(u \tau^{\nu y}).
$$
Assuming that $F(x)$ is regular as $x\to 0$, the singular behavior of $f$ is given by $\tau^{\nu d}$ from which we get $\alpha$ by deriving twice with respect to $T$. We thus obtain the corresponding hyperscaling relation.
However, this assumption fails for $d\geq 4$, as $F(x)$ is singular in this case (this is because the RG fixed point is now the Gaussian fixed point, instead of Wilson-Fisher fixed point). By a mean-field argument, one gets $F(x)\propto 1/x$ instead, and $u$ is called a dangerously irrelevant variable (dangerous since $F$ is singular as $x\to 0$). Furthermore $y=d-4$, and putting everything together, one recovers $\alpha=0$, as expected from a purely mean-field calculation.