I found a note in Collins dictionary:
You only use ago when you are talking about a period of time measured back from the present. If you are talking about a period measured back from some earlier time, you use before or previously.
However, here are choices that all sound right to me.
A month earlier/before/ago, our relationship ended. Our relationship ended a month earlier/before/ago. (I intend to mean a month before now. I think the sentence order does not significantly affect the word choice here.)
He had died a month before/earlier/ago. He died a month ago. (I intend to mean a month measured back from the present. I think the tense does not significantly affect the word choice here.)
She had rented the flat some fourteen months previously/before/earlier.
When I make appointments, I will think obsessively about the appointments several hours previously/before/earlier.