Technically, the second generation of the iPhone is the iPhone 3G. While the first-generation iPhone was still being sold, Apple bumped up the capacity and began offering a 16GB model (the first ones sold at release had only 4GB or 8GB of storage). Other than that, there were no hardware changes to make it a true "generation."
First generation: all aluminum-backed iPhones with 4GB, 8GB, or 16GB of storage
Second generation: iPhone 3G, 8GB or 16GB
Third generation: iPhone 3G S, 16GB or 32GB