You're on the right track. In edit mode, the cursor needs to be on the ground plane first (which can be done with SHIFT + C to reset the cursor to the world origin). Then set your pivot to cursor, select all mesh components, and scale to zero in the Z axis (S + Z + 0)