Theory of electrical instabilities of mixed electronic and thermal origin. II. Switching as a nucleation process