Mr. Cantor’s loss recalled the defeat of former Speaker Thomas S. Foley, a Democrat who lost to a little-known Republican, George Nethercutt, in the 1994 general elections that delivered control of Congress to the Republicans.