Uh... wasn't it just the Molotov-Ribbentrop pact (or rather, the secret parts thereof) where Hitler and Stalin pretty much divided East Europe between themselves ? Both would get a piece of Poland, and if the Soviets now felt like it they could attack Finland all they wanted as far as Berlin cared (at the time the Nazis were still largely dismissing Finns as a bunch of Mongols little different from the Russians, which attitude duly changed drastically once they became potential allies... kind of like how they went through some impressive rhetorical and theoretical contortions to rank the Japanese as "Aryans"). Unless I've been getting something important entirely wrong for a very long time, the invasion of Poland only came after that, right ?
AFAIK aside from sheer land-grabbing opportunism what motivated Stalin to go with the deal was his inability to get France and the UK agree to some sort of defense treaty against Germany, which he was (quite correctly) rather worried about. Failing that he then got friendly with the Germans in the hopes that'd keep them off his case - no doubt both Nazi and Communist sympathizers worldwide swallowed their tongues at the supposed arch-nemeses getting all cozy like that too...
Bookmarks