Q: Was this ever enforced against a Confederate veteran?
Section 14 of the Enforcement Act (see below) was used to remove some from office, Such removal was without penalty.
Q: Did any court ever rule that a person who had taken an oath to support the Constitution of the United States and then supported the Confederacy could not be on a ballot?
After the ratification of the Fourteenth Amendment in 1868, Congress passed the Enforcement Act of 1870. Section 15 (see below) of the Enforcement Act made it a misdemeanor, subject to imprisonment and fine, to even "attempt to hold" office. It seems rather unlikely to have needed enforcement to keep one's name off a ballot. [File for election, go to jail.]
Enforcement Act text:
Sec. 14. And be it further enacted, That whenever any person shall hold office, except as a member of Congress or of some State legislature, contrary to the provisions of the third section of the fourteenth article of amendment of the Constitution of the United States, it shall be the duty of the district attorney of the United States for the district in which such person shall hold office, as aforesaid to proceed against such person by writ of quo warranto, returnable to the circuit or district court of the United States in such district, and to prosecute the same to the removal of such person from office; and any writ of quo warranto so brought, as aforesaid, shall take precedence of all other cases on the docket of the court to which it is made returnable, and shall not be continued unless for cause proved to the satisfaction of the court.
Sec. 15. And be it further enacted, That any person who shall hereafter knowingly accept or hold any office under the United States, or any State to which he is ineligible under the third section of the fourteenth article of amendment of the Constitution of the United States, or who shall attempt to hold or exercise the duties of any such office, shall be deemed guilty of a misdemeanor against the United States, and, upon conviction thereof before the circuit or district court of the United States, shall be imprisoned not more than one year, or fined not exceeding one thousand dollars, or both, at the discretion of the court.
[The fine of $1000 in 1870 is about $23,439.01 in 2023.]
Section 3 of the Fourteenth Amendment applied only to those who had taken an oath to support the Constitution, exempting those who never held office. After reunification, many offices were filled by Confederate veterans who had not previously held office.
The Amnesty Act of 1872 removed the disqualification for most previous officeholders, so the disqualification for those Confederate veterans lasted only two years.
Those who remained disqualified were certain previous members of Congress and those convicted under the insurrection provisions of the Confiscation Act of 1862 who remained disqualified for election to federal offices.