Crossover to mean-field behavior at marginal dimensionality