You have plenty of time to reverse the situation.
First, wait about a week after you've received confirmation that your e-filed return was accepted (or 2-3 weeks after mailing, if you paper-filed).
Then, visit or call your local IRS office (fastest) or call the IRS at 1-800-829-1040 to explain that you want your applied refund transferred back to the current tax year.
You'll get your check refund in approximately 3-4 weeks. Electronic deposit isn't available in these cases.