1893, American English, in the figurative sense "fear or doubt that reverses an intention to do something;" the presumed Italian original (avegh minga frecc i pee) is a Lombard proverb meaning "to have no money," but some of the earliest English usages refer to gamblers, so a connection is possible.
c. 1600, "victory involving one's own ruin," translating Greek Kadmeia nikē, from Cadmus (Greek Kadmos), legendary hero-founder of Thebes in Boeotia and bringer of the original sixteen-letter alphabet to Greece. Probably a reference to the story of Cadmus and the "Sown-Men," who fought each other till only a handful were left alive. Compare Pyrrhic (adj.1).
"principal line of a railway," 1841, from main (adj.) + line (n.). Meaning "affluent area of residence" is by 1917, originally (with capitals) that west of Philadelphia, from the "main line" of the Pennsylvania Railroad which added local stops to a string of backwater towns west of the city late 19c. that helped turn them into fashionable suburbs.
The Main Line, Philadelphia's most famous suburban district, was deliberately conceived in the 1870's and 1880's by the [Pennsylvania] Railroad, which built high-toned housing developments, ran hotels, more or less forced its executives to plunk their estates out there, and created a whole series of somewhat spurious Welsh towns along the railroad tracks. ... Now everybody assumes these all date from 1682, like the Robertses; but as Chestnut Hill people like to say, "nobody but Welsh peasants lived on the Main Line till the Railroad built it up." [Nathaniel Burt, "The Perennial Philadelphians," 1963]
The original station stops were, in order out from the city, Overbrook, Merion, Narberth, Wynnewood, Ardmore, Haverford, Bryn Mawr, Paoli. The train line for commuters along it is the Paoli Local.