How does $S = k\ln W$ relate to the statement that heat does not flow from cold to hot objects? There're several ways the Second Law of Thermodynamics can be stated. I'm thinking of these two:

Entropy never decreases spontaneously.

and

Heat does not spontaneously flow from cold to hot objects.

From the first statement, we know that the entropy of the object is given by $S = k \ln W$, where $W$ is the number of microstates. How is this equivalent to the second statement that heat does not spontaneously flow from cold to hot objects? The second statement doesn't seem like it is related to microstates at all.
I tried drawing two systems, one which has five accessible quantum energy levels (corresponding to higher temperature) and one with only two levels. The first system then has five different microstates and the second has only two. If heat were to flow from cold to hot objects, then the second object would have only one energy level while the first one has six. Total entropy is now $k \ln 6 + k \ln 1 < k \ln 5 + k \ln 2$, i.e. entropy has decreased, which makes the entire approach sounds like nonsense.
 A: A qualitative answer to your question is that a system at higher temperature has higher W, all else being equal.  So if you take a certain quantity of heat $Q$ out of a system at high temperature $T_h$, without doing anything else, the change in entropy is $-\frac{Q}{T_h} = k \frac{\Delta W_h}{W_h}$ (where $\Delta W_h < 0$), and if you put that same heat into a system at low temperature $T_l$, its change in entropy is $+\frac{Q}{T_l}= k \frac{\Delta W_l}{W_l}$ ($\Delta W_l > 0$).  If you add these, the net change of entropy of the system is proportional to $\Delta W_h W_l + \Delta W_l W_h$.  Because the $W$'s are enormously large and for small increments of heat the $\Delta W$'s are much smaller, this is positive if $W_h > W_l$, which it is.
Your example is not the right way to think about it.  Instead, you want to consider either your 3-state or your 5-state system at two different temperatures, that is, populated by many particles, but with a different average energy for each particle.  For example, using your 3-state system, W would be the number of ways you could arrange N particles in your 3 levels with a given average energy.  You'll find that if you take some energy out of the high-energy levels and distribute it among the low-energy levels, the number of ways to arrange particles increases, while the reverse is true for the opposite.
