Teoretically it is possible. Hitler did try to make some kind deal with Poland, making some vague suggestions about Lithuania or some part of Ukraine. Poles didn't trust him (quite rightfully) but for some time Nazi Germany and authoritarian Poland had relatively good relations. It would require Hitler to stop most of his anti-Slavic rhetoric, not to invade Czechoslovakia (which destroyed his credibility, but was kind of necessary for economical reasons), Stalin to be seen as more aggressive and France and Britain more passive. If Poland had felt threatened by the USSR and had lost its faith in the western Allies, Warsaw might decide that loosing Danzig and extraterritorial passage through the Corridor is worth saving the rest of the country.
However I do not believe in Poland making an aggressive anti-Soviet alliance with Germany. Despite Poles bullying Lithuania and Czechs, Poland was not ready for an aggressive war. It wasn't even prepared for full scale defensive war, and Polish commanders knew that quite well (the big modernization of Polish army was to start in early 1940s). Invading USSR was too risky with too small potential gains. A small victorious war against some weaker country (Lithuania, Czechoslovakia) - absolutely possible. Full scale aggression against USSr? No way.
Anyway, as I mentioned, Poles did not trust Hitler, or any other German leader in the past, and they had good reason. So an alliance with Hitler would be for Poland a desperate solution, like choosing a lesser evil.