I've missed this one!
I use a mix of a few things:
1. the direction that comes from the hand itself.
2. the position of the hand relative to the head - this is used with the world's up to tell in which direction should we bend
3. arbitrary direction to the side and back
These three are mixed but the weights depend also on where the hand is relatively to the head (for example for hand being quite low, we use more of the direction from point 3).
The result tells in which direction should the elbow go and standard 2-bone IK is applied.
But there's more to it. There are additional bones for arm and forearm to twist to match the hand (for forearm I use hand's right dir).