Stochastic theory of metastable states and nucleation