the_post_thumbnail() doesn’t always return selected size

Those might be old images. Image uploaded to WordPress before adding this new image size code will not resize automatically. You will have to resize old images again.

There is a great plugin for that. Use Regenerate Thumbnails plugin to auto generate thumbs for all images. If you ever add a new image size then always resize images again with this plugin.