Phew that's a relieve. To be honest this is only my 3rd brew and it's never happened before. I'm not 100% clear what the airlock is for except to keep wondering bacteria out?
The good news: During active fermentation it is very difficult for contamination to take hold, mostly because of the positive pressure of Co2 coming out of solution pushes everything out. As far as contamination goes, your beer would be fine.
The bad news: Blow offs like that usually happen when you pitch too warm, and especially when you don't have good control of fermentation temps. I recently pitched US-05 at around 78 degrees for an "experimental purpose" and the fermentor had plenty of head space and still blew off. Normally, when I pitch at a more reasonable temperature like 64, I get no blow off. And the thing is, warm pitching and fermentation temps are almost as bad for the flavor of beer as contamination. You should never pitch over 70 degrees (and preferably much cooler) and you should never let the temp of the fermentation - which can be as warm as 6-8+ degrees over ambient - get much warmer that 68 degrees (70-72 at the highest) for most ale yeasts. In other words, if you are fermenting at "room temp" you are fermenting too warm, unless your rom temp in 58-62 degrees.