The two events are not far apart.
Stalin's purges would effectively cripple the ability for the Soviets to counter the invasion of their Motherland. Below are a few main points on how the purges hurt Stavka (Soviet High Command).
Mikhail Tukhachevsky, a Soviet marshal was executed in 1937 as a result of the purge. Tukhachevsky would theorize and assist in reforming the Red Army leading up to his execution, including his ideas about the uses of armour as well as aircraft in a combined-arms role, notable from the German's use these tactics would eventually prove to be highly effective. As a result, one of the most senior Soviet military officials was removed from the chess board that was the Eastern Front before the tanks even started rolling during Operation Barbarossa.
The Soviets decimated their Officer Corps and NCO Corps, effectively creating units with little to no tactical military experience. This was due to the issues that the Starshinas (Soviet Sergeants) were more often selected for political reliability rather than merit from a military perspective. In the end, the NCO Corps was more akin to junior NCOs and was hopeless short one experience, and the NCO's job is to impart wisdom on the younger ranks and to maintain discipline.
The lack of experience at the higher levels of command v. political reliability to keep Stalin feeling safe effectively removed the Soviets of strong strategic thinkers. This is not to say that there were none, just that those who had fought during the First World War had been executed.
To conclude, the Purges left Stalin without experienced commanders and with hose that were only politically reliable. His junior ranks were also filled with officers selected for political reliability v. military merit, leaving the Soviets ill-equipped to fight against the Wehrmacht as Operation Barbarossa approached.
Sources: http://militaryhistorynow.com/2015/08/31/the-enemy-within-five-little-known-facts-about-stalins-purge-of-the-red-army/ http://www.haciendapub.com/randomnotes/stalinism-bolsheviks-and-revolution%E2%80%99s-fatal-statistics Note: Wikipedia used to reference dates of death for named figures.