Here's some maths to help the decision...
You get a €250,000 mortgage over 30 years at 3.1%, to buy a house for €272,000. So you've spent €13,600 Stamp Duty and invested a €22,000 deposit, plus €2,000 legal and valuation costs. Total outlay from you ~€37,000.
At the end of three years, assuming no increase in interest rates you'd still owe €234,000 on the mortgage.
Scenario (1) - house prices increase at 3% per annum for the three years. You sell the house for around €289,000 after auctioneer and solicitor fees, pay back the lender their €234,000 leaving you €55,000. Not bad for an outlay of €37,000 after 3 years.
Scenario (2) - house prices stagnate for the next three years. You sell the house for €272,000 but the auctioneer and solicitor take €8,000 between them leaving you €264,000. You pay back €234,000 to the lender and have €30,000 left over. You spent €37,000 so you're losing money.
You need house prices to increase in the period before you emigrate for this to work, assuming you don't plan to rent the house out when you're gone. If they don't increase or drop even a small bit, you're losing money. You also would be affected by any increase in interest rates in the interim.