The OED recognises both uses of the verb 'deliver', under their meaning 3.
In both cases, and fundamental to the meaning of 'deliver', is the idea of freeing and releasing. Note that they refer to the second (or b) as the passive.
a. To disburden (a woman) of the fœtus, to bring to childbirth; in pass., to give birth to a child or offspring. Rarely said of beasts. (The active is late and chiefly in obstetrical use.)
†b.pass. Of the offspring: To be brought forth (lit. and fig.). Obs.
This has been an excellent question.
It is certainly still current usage, in my experience in Britain, and at least in print, to speak of the mother as the one who has been 'delivered'. ('She was delivered of a nine-pound baby son'.) But you also see 'the mid-wife assisted in the delivery of a baby girl'. Indeed it not uncommon I believe to speak of the doctor or mid-wife as the one who delivers. It now seems clear that the doctor can both deliver a mother (from the rigours of childbirth), and a child (into the world)
In answer to the question as to when the mother is first spoken of as the 'deliverer' as opposed to the 'delivered', the first OED reference is from 1581.
1581 G. Pettie tr. S. Guazzo Ciuile Conuersat. (1586) i. 12 All beastes so soone as they are delivered from their dam get upon their feete.
There are also a couple of references from Shakespeare circa 1609.
Edit 4/July/2020 Reviewing this matter again after six years I believe @Peter Shor summarises the position succinctly in his comment thus:
If you search Google books for "delivered a child", in the 19th
century, it's always a doctor or a midwife delivering the child. In
the early 20th century, you see that some mothers have started
delivering their own children. But in the 19th century, it's doctors
either delivering a child of a woman, or delivering a woman of a
child.
I now believe that @Blckknght made a pertinent contribution when he said:
This is only a guess, but I wonder if mother-as-deliverer arose due to
drift in the meaning of "deliver". I don't think any modern speaker
would use "deliver" to mean "disburden" or "liberate" these days, as
the "carry" and "hand over" usages have taken over. If "deliver a
baby" was already a phrase in the collective vocabulary, it might make
sense for the exact sense of who is doing the delivering to change
along with the meaning of the word "deliver".
There has clearly, across the centuries been a drift in the meaning of "deliver". Though to me it seems that the two meanings of deliver - a) to liberate someone of something and b) to hand over something to someone, have co-existed across time. There is an OED example of b as early as the thirteenth century.
Thanks to Peter's succinct summary therefore:
a)In the 19th century, it's always a doctor or a midwife delivering the child.
b)In the early 20th century, you see that some mothers have started
delivering their own children.
c) But in the 19th century, it's doctors either delivering a child of a woman, or delivering a woman of a child.
Added to this is the additional curiosity that so far as the animal kingdom is concerned, mothers were apparently delivering offspring as long ago as 1581.
1581 G. Pettie tr. S. Guazzo Ciuile Conuersat. (1586) i. 12 All beastes so soone as they are delivered from their dam get upon their feete.
Best Answer
This is the process of semantic change called degeneration or pejoration:
The entry for villain confirms this degeneration process:
Another example of pejoration is knave:
Often words associated with things that are lower on the subjective "nobility scale" deteriorate into more and more ignoble meanings. The feudal tenants were essentially slaves, and this word, which was associated with them, became increasingly ignoble over time, until it reached evil criminal.
Villain is a person associated with the villa in the same way as chaplain or captain are a person associated with the cap. Starting at this origin yields a reasonable degeneration:
Perhaps the currently popular tenets of socialism have begun to strike back on behalf of the peasants by labeling the rich and powerful as the villain. That would be a reasonable connotation, but it has not necessarily "flipped" the definition.
Our generation has experienced this process of degeneration recently in the expression jones:
Jones Alley is a small dead end street in the middle of NoHo, a curently upscale neighborhood in Manhattan. The neighborhood flourished from its establishment in the 1820s until its first peak in the 1910s, then it declined through the 1960s. At the neighborhood's nadir, Jones Alley was supposedly a convenient lair for drug dealers, and one of the many nicknames of heroin was jones:
Although the details of this etymology are not 100% certain, our relatively recent cultural experience with addiction can help us visualize the linguistic process of pejoration toward the end of the word's development: