How could the precession of Mercury be known so accurately in the 19th century?
Some of the most accurate measurements of the solar system come from event timing. (Relatively) small changes in position can lead to significant differences in eclipse or occultation timing.
In fact the article on Tests of general relativity mentions that this was the method used to first notice the discrepancy.
This anomalous rate of precession of the perihelion of Mercury's orbit was first recognized in 1859 as a problem in celestial mechanics, by Urbain Le Verrier. His reanalysis of available timed observations of transits of Mercury over the Sun's disk from 1697 to 1848 showed that the actual rate of the precession disagreed from that predicted from Newton's theory
Transits of Mercury as observed from Earth occur in either November or May, with roughly 2/3 of them occurring in November. The November transits occur days before Mercury's perihelion passage while the May transits occur about a month after Mercury's aphelion passage. That tiny 43 arc seconds per century means that over the course of 150 years, there will be a four minute discrepancy in the timing of the November transits, and an even greater discrepancy in the timing of the May transits.
Clocks were accurate to within a few seconds per day by the end of the 17th century. That four minute cumulative discrepancy between the timing of the November 1697 transit and the November 1848 transit was well within the accuracy of late 17th century clocks to mid 19th century clocks.