Most shells support scrolling through recent commands by using the up and down arrow keys at the prompt. Terminal.app also supports positioning the cursor by option-clicking at any point in the terminal window. You have to enable this feature by checking the "Option-click to position cursor" box in the Terminal's Window Settings -> Emulation panel.
Use these two features together to quickly scroll up or down through your your last n shell commands by clicking n lines above or below the command line. For example, press the up arrow, then option-click five lines up to bring back the fifth previously executed command.
Mac OS X Hints
http://hints.macworld.com/article.php?story=20041129202506463