Zend certified PHP/Magento developer

How can i overwrite file from vendor so that setup:di:compile won’t read it

I have a 3rd party module that is giving some deprecation issues.
Is there any way to replace the class that is having problems in my own module in app/code without moving the whole module from vendor?
I have tried creating module and writing preference for that class, adding the problematic file in main composer.jsons autoload[‘files’] section but setup:di:compile still fails as it loads all classes even if not loaded in the project by autoloader.