It's complicated.
Not every kind of remote access will wake every kind of computer on certain kinds of network. i.e., it depends.
The wake on demand feature Apple touts is for bonjour services, and it requires their network hardware. So if you have a non-apple router that won't work.
Other types of access can work with a remote Mac, but you have to have the appropriate application running so that it can "hear" the triggering packet coming down the pike. Not sure that TeamViewer knows how to do this, but I would expect it should. Check with their support. And try other services; I found when I had problems if I used my iPhone to connect via one service (like remote login) then it would be awake and I could switch to printing or whatever.
Another work around involves your router. Set up a static IP on your Mac instead of a changing one (note this is for your local address, not the internet). The reason is that for some routers this makes them keep the info about where that computer is for longer and hence the packet telling the computer to wake gets where it's going. If you had noticed that the wake feature worked immediately after sleep but not hours after sleep this might help.
Along the same lines you can set up port forwarding to send a wake packet; 9 is commonly used and you can find web sites that will send the packet for you.
Rob