A little background: as a way to learn multinode trees in C++, I decided to generate all possible TicTacToe boards and store them in a tree such that the branch beginning at a n
Your existing algorithm is good, except you are forgetting one thing. Never choose any path where a move by the other player results in you being unable to at least tie.
So basically, discard any branch where the players next move could result in an un-tieable situation and then run your existing algorithm. This results in the highest chance of winning against a non-perfect opponent, while removing the possibility of losing.