A vanishing cursor in Team Fortress 2 usually points at Steam's overlay or the game's input handling rather than the mouse itself.
First, check whether it happens in your other Steam games — that single answer splits the problem in two. If it affects everything, reinstalling or repairing Steam is a reasonable next step. If it is only TF2, verify the game's file cache instead.
Disabling the Steam community overlay for that title, and running the game in windowed mode with a border, are both quick things to try before anything more drastic.