After a daylong pummeling, stocks shed much of their worst losses in the final hour, as small caps turned positive.