i did quite a bit of web browsing on this topic. mammals are
synapsids, reptiles are
anapsids or
diapsids--there's one other type of reptile that included icthyosaurs, i think, but they're all extinct. dinosaurs, birds, snakes, and lizards are diapsids, but turtles are anapsids.
dimetrodon is maybe the best-known fossil synapsid. they were once described as "mammal-like reptiles" but now they're just non-reptile
amniotes, i guess.
the fossil records for both reptiles & synapsids go back to about 310 or 320 million years, at the Joggins area of Nova Scotia. either they had a common ancestor, in which case they're all reptiles, or they evolved separately from amphibians. if i learn anything more, i'll post, but it's a lot of data to wade thru.
[update] i've come across a candidate for the earliest amniote, and hence ancestor to mammals, reptiles, or both--
casineria--which preceded synapsids & anapsids by 20 million years. here's a tiny image of a hand, with five digits, only one of which is complete:
and here's a link to an article about it. since the fossil lacks a skull, it could have been synapsid, diapsid, or neither:
http://www.sciencenews.org/pages/sn_arc99/5_22_99/bob1.htm