#The spell counts as the level at which you cast it
The spell counts as the level at which you cast it
The rules on spellcasting (PHB, 201) cover that:
When a spellcaster casts a spell using a slot that is of a higher level for that casting, the spell assumes the higher level for that casting. (PHB. p 201)
If you upcast a 2nd divination spell to 3rd, you'll count it as a 3rd level spell and can regain a 1st or 2nd level spell slot.