There is high possibility that you are here because you read other blog post but they didn’t work as it happened with me, so I thought to write a blog post.
As per latest version of woocommerce, it itself hooks the post_class and add the ‘last’ and ‘fist’ class
add_filter( 'post_class', 'wc_product_post_class', 20, 3 );
So, if you hook post_class to remove first and last class then either you can remove the filter or you can add another filter
Here is a ref to this issue