Stack Overflow requires an OpenID identity in order to ask questions: you cannot sign up without one (though SE now provides their own you can sign up for). You could easily set up your own (and it's surprising that Ulbricht did not), but you could also use any number of providers (e.g., Facebook and Google) that ostensibly know your real name.
When you link your OpenID to SE, SE automatically fills in your name with whatever your OpenID provider has on file. I believe this is where Stack Overflow got his real name from initially. He probably didn't realize this would happen and when he saw that it did, he quickly changed his Stack Overflow profile to the "frosty" moniker.
Though it was absolutely boneheaded (possibly with a fair amount of hubris that he'd never get caught) to have an OpenID identity somewhere with his real name and then use it on an untrusted (to him) third-party site, had the SE login page indicated that it would pull information from his OpenID identity to create his SE profile or emphasized creating an account with SE over logging in with OpenID, he might not have had his name leak in this manner.