I hate the expression "solder flows toward the heat".
Solder isn't possessed of some heat-seeking anti-gravity magic.
Solder flows on surfaces it can "wet", when it is hot enough to remain molten, and within the constraints of gravity, its viscosity and shape of its meniscus.
Sure, that's not as simple, but it's right.
If solder flows toward heat, all you would need to desolder something would be a hot iron. It would just draw the solder away. But as we know, if to surfaces are hot enough to keep solder in a liquid state, solder will be drawn up into a relatively cooler place. Solder wick is a perfect example. Another example is soldering a TO220 heatsink tab to a PCB.
What we need to teach us that the surfaces to be soldered need to be "wetable" by solder (I.e. tinned, or gold plated, silver plated, copper, brass, ... All the metals you can solder), they need to be clean (no excessive oxide, solder mask, oils, etc), hot enough, and the solder needs a reason to be there.
Some parts are simple, the whole joint need to be hot enough, of the right type of materials and sufficiently clean (generally so the flux can clean up and keep clean the surfaces before they are covered in solder).
The part that isn't so simple is making the solder "want" to go there. Unless it's being wicked up, it won't go uphill far against gravity, no matter how hot the joint is.
One simple trick is to use a little bit of solder on the tip to assist with heat transfer, then use the solder to "paint it" where you want it. Rather than applying the solder to the joint near the tip and just waiting for it to spread itself around the joint, you simply paint it on around the joint. The flux is where you want it, and you know the joint is hot enough because it is melting the solder.
Done this way the solder will wick into most joints rather than flowing over them. It's also a lot faster.