This is not correct, but it's a popular belief. If you leave the track/pits your name will be removed from the on-track leaderboard you see on the right-hand side of the screen. If you re-enter the track it will put your name at the bottom of that leaderboard but that only indicates your position on track. Your best lap time is still recorded in the live-timing monitor and you will be started according to that time.
Without a doubt, I can confirm this is true. Many qualifying sessions in the Capp Cup and in online lobbies and the game remembers your Q time if you leave the track for the pits or the garage, just doesn't display it as such. However with GT5 anything is possible, so don't be surprised if it works 1000 times and then doesn't work once when you race...lol.
I think one of the things that confuses people is the sequence of events. Everyone rushes out to qualify in online racing so you have usually several cars on the same lap. If you are out of the pits 3rd out of ten, you finish your Q lap, and you set fastest lap, you are the fastest of the 3 that have finished their lap. You go into the pits, and while in the pits, the 7 guys behind you finish their laps and if 4 of them outqualify you, you don't know because lap times aren't posted, just the order. The fastest lap is posted, so you know if one person has beaten you, but not if anyone else has at the same time.
So you go back on track, notice your fast lap was beaten by a half second by Joefastguy and assume you're in second. What you don't realize is, 4 other guys might have beaten you by 1/10th, 2/10ths etc. Now you are actually in fifth place. So out for your second session after a little adjustment, and the top 4 guys in front of you all drop back into the pits for an adjustment, you run a good lap within a couple of tenths of the Q time so now it shows you second. But because of all the pit in and out stuff, you are not in second overall, but second place of all the cars on the track, because by going into the pits, the guys ahead of you have dropped back to the bottom of the list, in spite of their faster Q time.
Confusing I know, but this is how it works. Dumbest thing ever. How someone could design a racing game that doesn't display who is the fastest qualifier is almost beyond belief...but there you have it...lol. You don't have to stay on track, nor avoid making adjustments to the car, that's a big myth. The only advantage to staying on track is that the game will display the true order of qualifying, but at the cost of being able to return to the garage and make adjustments.