This one dude has code for object selection using the stencil buffer, which he claims is pixel perfect. Unfortunately I can't find where to download his example. All I see is code to do an object selection lasso

http://gpwiki.org/index.php/Object_selection_lasso