So (total speculation) ...
I think Locke "knows what's coming". Kind of like Bill Murray in the movie Groundhog's Day (Bill wakes up every morning on the same morning ... he remembers his previous Groundhog's Days, but to everyone else it's happening for the first time).
Locke just happens to "show up" at the right time and place to effect change. Off the top of my head ...
When he knocked out Sayid to stop the triangulation with the radios
When he arrived to save Jack from falling off of the cliff
He has several times met someone in the jungle
The cradle making thing with Claire
Finding Charlie's guitar
Also, his skills seem way overdeveloped (hunting, cradle making, tracking, lock-combo-resetting, etc.).
I don't think he knows everything, because I think he may have tried different things in his past experiencing of the island.
So thinking about Wednesday's episode ... Locke may have followed Charlie to his stash ... or may have already known where it was. And when he was talking to Charlie, he was very pointed about telling him to stay away from Claire, that trust takes a long time to build back up. Yes, he could have been talking about what already happened, but what if instead he was trying to keep Charlie from doing what he did.
Okay ... it doesn't work exactly, because you'd think Locke would know about Charlie taking the baby when the fire starts ... but maybe Locke know if he doesn't help with the fire, the fire gets out of control, so the most he can do is warn Claire.
Just speculatin'