I understand what you mean by the crapshoot part, but, given the choice between a top tier company and a middle tier grad school, I'd go with the top tier company every time. Between top tier grad school and middle tier company, I'd choose the grad school. Maybe this is a little shallow of me, but it seems like a reasonable heuristic, all other things being equal.
A friend of mine graduated with a CS PhD last year, and he just took an interesting job working on the key algorithms behind one of the "big names" in tech today. But other opportunities he was offered were the same as he would have gotten with 10 years of software development experience.
I'll also say this - if you don't get your PhD now, it's a lot harder to go back and do it when you have a mortgage and other commitments.
Getting into a 'top tier grad school' is a crap shoot, much like a getting into a 'top tier' company. You should probably figure out whether you want to spend a lot of time doing research or not, and look into whether you like the sort of jobs CS PhDs wind up doing after a PhD, not phrase your queries narrowly in terms of which top tier option is better.