Unfortunately, there's no way to automate what you described, but you can of course just manually add a new discount whenever someone pays for the old version, and send them that discount code personally.
You'd want to set Max. Use Count = 1 when you add the discount, so the code can only ever be used once -- i.e., they can't usefully share their code with others. You can use the site Random.org/strings to generate a random code to use, or you may just want to use the buyer's original Transaction ID as the code, so you can associate any discounted new-version purchase with their original old-version purchase in your E-junkie Transaction Log.
Come to think of it, you may just want to set up a big batch of random Discount Codes all at once in advance, for a token Flat Amount such as 0.01. Then you can just edit one of those to enter the proper amount and (if you wish) change the code to the buyer's old-version Transaction ID whenever you want to send someone their discount.
The advantage to that approach would be that all Discount Codes created in a batch together are kept under a common Discount Name in your Current Discounts menu, so that will help you keep things manageable there. You can paste the initial list of random codes (one code per line) into the Discount Code(s) box when you first set this up, which will spawn off as a series of single-code discounts all stored under a common Discount Name.
(BTW, in actuality every discount must have a unique Discount Name, so these batched discounts will actually each have a unique suffix in their Name, which is hidden behind the scenes, and we group them according to their common, visible prefix.)