We're never far from from chain brand java in times of desperation, but there are always better options if you know where to look. To that end, app company Butterfruit Labs put together a coffee shop map that name drops the best coffee shop by subway stop.
The majority of the shops are independent, though apparently the 2/3 stop at 110th Street is a caffeine dead zone. It would be even more helpful if there were addresses associated with each coffee house—you'll have to wait for that feature on your phone, Android users.
Differences of opinion are inevitable—I'm partial to the potent Mudshop for my Astor Place fix and prefer DTUT over Effy's on the UES—but it's a good starting point if you're in a fix.