As I've pondered the topic some more, I've wondered if this notion--that God's justice and mercy necessitate a heaven--is in part what led to a development throughout scripture of a belief in an afterlife. For example, in Isaiah's prophecy of the Messiah, God restores Israel and renews all things through the Messiah as peace covers creation. But what about the Jewish people who anguished in captivity and would not live to see the Messiah? Where's the justice in that? Ah, but what if the dead are resurrected to join with the living in that time?
Now, I'm not suggesting rabbis and biblical writers simply worked through philosophical exercises and eventually wound up at a belief in immortality. However, clearly the belief in an afterlife developed over the course of scripture, moving from the murkiness of Sheol in the early OT to the more fully formed--albeit varied--ideas presented in the NT--and I think a belief in the ultimate justice of God had something to do with that.
Lastly, without any sort of smooth segue, does John 17:3 possibly challenge our typical notions of an afterlife? In Christ's prayer, he declares "Now this is eternal life: that they may know you, the only true God, and Jesus Christ, whom you have sent."