I've been suffering from a similar issue for about a month. I have a MacBook Pro 15" i7 that I got in April of this year. As long as an external monitor (and I use two different ones on a regular basis) is plugged in, I've been experiencing sudden sleep, from which I can only recover via a hard restart. These have increased in frequency over the course of the last month. It's been happening three times a day lately. It has been very frustrating.
For me however, it's not been entirely random. About a month ago, I bought an HP All-In-One (model j4680), because I needed a scanner and a printer. In addition to the RANDOM crashes, I have been able to reproduce an identical crash by attempt scanning in Image Capture. After the scanner warms up, the computer just goes to sleep and the displays go dark.
I went to the Apple Store tonight (5th Ave, NYC), exasperated. After a long session of explaining the issues - the dual monitors, the scanner, the fact it hadn't happened once when I wasn't connected to an external display, the tech (Nick) was going to take it in, but since I can't really part with my computer right now, we came to the conclusion that I could essentially perform the same diagnostic Apple would - running with a clean profile and attempting to duplicate the issue. But as many people in this thread have noted, Apple doesn't seem to have similar setups to most of us - While we have Mini DisplayPort Adapters and various different monitor brands, Apple has Apple monitors and Mini DisplayPort to DVI cables. So I was less than optimistic they'd necessarily be able to duplicate the issue, even in five days of occasional diagnostic use. So armed with the knowledge of this weirdness, I went home, to try a new profile, and wait for the randomness to start again. But then Nick reminded me of my scanner - just try that out on a new profile and see what happens.
So I get home, hook up my monitor, open my computer, and boom, within seconds, lights out, crash. So I restart, and create a new profile - Colonel Panic - and log in. I try to launch Image Capture via Spotlight - boom. Crash. Restart, log in as CP. Launch Image Capture, start scan. Just as I expected - Boom. Crash.
I disconnect my monitor and restart, launch Image Capture, and begin to scan. Expecting failure - how could something as simple as plugging in an external monitor, something I've been doing to Macs for years, be so broken - I was shocked when the scan continued past the warming up stage and...scanned. For the first time ever. So I switch users, back to my original profile. Scan again - success again. And then, the moment of truth. I plug my monitor back in, and attempt to scan. Boom. Crash.
For good measure, I tried scanning with Mini DisplayPort to VGA and DVI adapters, and both failed. At this point, I'm pretty sure that something is REALLY broken as far as using an external monitor on recent MacBooks and MacBook Pros - something that I'm not sure even a logic board replacement would fix.
TL;DR My MacBook Pro crashes all the time and when I use a scanner - but only if I have an external monitor plugged in.