Does Invisible mode still allow you to gain hours in-game?
Yes, you should still be gaining playtime. Hours played, achievements, and etc are not related to your friends/chat status in any way.
Invisible mode is simply a way to appear offline while still being able to game, and you can still chat with your friends online if you decide to do so.