"having a sharp taste," late 14c., perhaps from Old English teart "painful, sharp, severe" (in reference to punishment, pain, suffering), of unknown origin; possibly related to the root of teran "to tear." Figurative use, with reference to words, speech, etc., is attested from c.1600.
"small pie," c.1400, from Old French tarte "flat, open-topped pastry" (13c.), possibly an alteration of torte, from Late Latin torta "round loaf of bread" (in Medieval Latin "a cake, tart"), infl. in Middle English by tart (adj.).
[1790+; a euphemistic alteration of damnation, apparently influenced by obsolete US slang tarnal damned, an alteration of eternal]