Err, I wasn't including undergraduate, just graduate. At least at the schools I know about, there isn't really much of a distinction between "thesis" time and PhD time generally. There's quals, but they aren't that important at a lot of places. Mostly if people say "I'm a 4th-year PhD student", it means they entered the program 4 years previously. They probably spent most of the first two years taking classes, though that varies too (I spread my classes over three years to have more time to start research earlier). I'm not even really sure how much time to allocate to my thesis, because there wasn't some official point at which I stopped doing classes and started doing thesis.
Edit: Actually, it just occurred to me you might be in Europe, where the norm is a three-year PhD thesis, in a pretty time-defined program. The PhD program norms are pretty different between Europe and the U.S. overall (I'm in the U.S.). Is that an accurate guess? If so, that'd explain the confusion. =] The U.S. program is fairly ad-hoc: you enter grad school and then there's various things that you can do in various orders, for various durations, depending on the school. Often you don't have to get a masters first either, so you sort of get that along the way, and you might be doing PhD research at the same time as that too.
Good guess. Where I'm from you can start on your phd work in your fifth year of study normally (for some earlier), and it takes 2-3 years after that to complete your project + thesis.
Edit: Actually, it just occurred to me you might be in Europe, where the norm is a three-year PhD thesis, in a pretty time-defined program. The PhD program norms are pretty different between Europe and the U.S. overall (I'm in the U.S.). Is that an accurate guess? If so, that'd explain the confusion. =] The U.S. program is fairly ad-hoc: you enter grad school and then there's various things that you can do in various orders, for various durations, depending on the school. Often you don't have to get a masters first either, so you sort of get that along the way, and you might be doing PhD research at the same time as that too.