Say I'm using Tor, and I make an error by, for example, logging into an account on a website. Will this deanonymization only affect my current session, since I can just restart my browser and get a new connection (and erase cookies, etc.)?
You should clean your system (on windows) after closing the browser with something similar to CCleaner to have no traces remaining. But Windows isn’t that save with TOR. If you want to do it right use Tails on an USB drive and reboot after a mistake like that.
But the best for both cases is not to make a mistake as the one you talked about...