Final-hour rally yanks Wall Street from maw of bear market