Actually Apple used to stop supporting after 2 major updates, but they stopped doing so with the 3GS and the 4 after they moved to tiered models. Also, as others have already pointed out, the 3GS received iOS 6 despite Apple ceasing sales.
They ceased sales... But they ceased sales when they released iOS6. Weeks and months prior to iOS6 launch they were selling 3GS as new.
Same situation will be for iPhone4 and iOS7; also iPad2 and iOS7.