On February 21, 1818, Representative Peterson Goodwyn (DR) of Virginia's 19th district died in office. A special election was held to fill the resulting vacancy.
Election results
Pegram took his seat on November 16, at the start of the Second Session of the 15th Congress. Pegram would only serve for that single session, as he would be defeated for re-election in 1819 against James Jones.
References
Virginia's 19th congressional district special election, 1818 Wikipedia(Text) CC BY-SA