First, you don't get a reference from a former employer. You get a reference from the PEOPLE YOU WORKED WITH at a former employer. Employers will rarely ever say anything other than "we verify that so-and-so was employed here from this month of this year to that month of that year, and it's our policy not to disclose anything further."
When you've given your notice at any job, go to one or more people there - it can be your manager, coworkers, even subordinates, just pick people you have a good working relationship with who you think will want to help you - and ask them very nicely if they would be so kind as to give you a "letter of reference". Explain nicely that you know people change jobs over time and you'd like the letter so that you'll always have their reference and so they won't have to be bothered with many phone calls about it. No one I have ever asked for a letter of reference has ever said no after I explained why. Some were concerned about giving me a reference on behalf of the company... I told them that I wasn't asking for a reference on behalf of the company, I was asking for a reference on behalf of them personally, and it didn't need to be on letterhead. They then agreed.
Once you've got the letter (or preferably letters), you can include it with your resume when you submit it for jobs, or send it when they ask for references. It's a little old-fashioned, but it often impresses potential employers and makes you stand out.
Now, after you've got the letter (and get it HOME), you don't need that employer who is giving you a hard time any more, and they don't have anything to hold over your head. So:
1) Explain bluntly to HR that you are fully aware that you've had stellar performance reviews and that you have given them the normal amount of notice that anyone in any industry gives, that it is inappropriate for them to be threatening you to demand more, and that if they ever give you a bad reference, you will sue them into the ground for defaming you and harming your career.
2) Leave at the end of your two weeks notice.
3) If they give you any further hard time about it, write a polite note to your manager at the company you're leaving, explaining that you're terribly sorry and really wanted to finish your two weeks but due to their hostility you feel this is no longer possible and that you consequently resign immediately. Give it to your manager, be apologetic, and leave. Take the rest of your two weeks off, then start your new job.
4) If you feel they'll be okay about it, you could call the new job, tell them the old job decided to let you go early, and ask them if they'd like you to start right away. Likely, they'll be happy.
Anyway, get that letter, or preferably several, and then you have nothing to worry about.