Or use the depth buffer to find the object with the least depth at that xy. It will be the one that got drawn over everything else.
i think many game engines do this, but this will not work for transparent surfaces. one option is to make a selection pass where EVERYTHING writes to the depth buffer (for transparent objects alpha discard can be used)