Yes you can leave. I've done it for an afternoon, and for an overnight.
You won't get charged the Airport tax as some other forums suggest you could.
With 9 hours, I'd go to TPE City to have some breakfast. I dont think the transit tours run that early from what I seem to remember.