In addition to our redirects article we have some more information on the topic to share with the public. The main point is what do we actually do with products that do not exist any longer. This is not a new problem since a video was posted in March, 2014 by Matt Cutts who shared the official Google take.
As a summary I can remind you that if your website is small in size, you can show related products on an out of stock product page, while if the site is medium in size you should 404 the page on the non existing product. With huge sites you should use a meta unavailable after tag prior to the disappearance of the product.
John Mueller discussed the topic in Google+ a couple of weeks ago and linked the post to Shaun Anderson who covered it. He answered that 301s may be treated from old to not direct the exact product as 404s. What John added later on is maybe the most important part:
The short version, imo, is to do what works best for the user, and search engines will generally figure it out from there too. Sometimes that’s a redirect, sometimes a friendly 404 page (and those can be customized too).