EDIT: As I see in the first answer, underline is the wrong word. I want a line under the section heading, separating the heading from the following text.
Rewriting your command like this should do the trick:
\newcommand{\tmpsection}[1]{} \let\tmpsection=\section \renewcommand{\section}[1]{\tmpsection{\underline{#1}}}
This will evaluate to
\section { \underline {#1} }
which in turn produces underlined section headings :)