This can be a useful trick if you need to troubleshoot a Mac that just won't boot up. Also, be sure to check out the freeware DasBoot application, which can make a lot of this much easier to do. The key is to also include your favorite troubleshooting utilities on the thumb drive (e.g., DiskWarrior, Tech Tool Pro, etc.).
You will need a 1GB or larger flash drive. It is impossible to install OS X on anything smaller. After testing this procedure multiple times, the largest free space I had after booting up was 11.6MB.
You will also need the original Mac OS X Install Disc(s) that came with your computer.