I noticed that when activating the "Application Initialization" feature of IIS 8.0 and 8.5 the home page images start to reference to localhost, cant be source from where the problems come needs more investigation. For sure is some Code/DLL issue.
I had this problem again in Azure, and it happened after I turned ON the "Always On" feature in the Azure portal for the website. I turned it off, and the images began to render correctly. Very strange issue as I cant see how its related to this setting either - so could be a co-incidence - but let us know if this also fixes it for you.
@aybelanov code change nearly worked. But in our dev environment we use hosts file entries and subfolders to test multiple stores. Here's modified version that worked for us:
1. Go to Nop.Service --> Media --> PictureService.cs --> GetThumbUrl()