TT - as for keeping the gun under the mattress and your concerns about being able to draw quickly, practice during the day and see if it would be a problem.
Also, as for sleeping with the gun under your pillow, as long as you are not one of those folks who 'roam around' the bed at night, go ahead and do it if the gun has a thumb safety ... generally, most guns of recent manufacture have two safetys, three if you count the primary safety, so should be safe enough under the pillow, cocked, locked and ready to roll.
I have read your other posts and agree with most here that you are doing the best you can and have a good idea of the steps you can take to maximize your safety.
One more suggestion I would offer is to get a recorder of some sort. The digital ones at WalMart are not too expensive, will record hours of voice and are easy to conceal, then add a gizmo from Radio Shack called a TP7 that will allow you to record phone conversations. And, as suggested, record and document each and every incident with the ex, including recording the statements of his friends that tell you of his threats to you (be sure to check the state statutes about whether you are a "one party" state or a "two party" state re recording.) While this may not be admissible in court, it will be documentation in your defense and can be used (no matter how obtained) as rebuttal evidence. When you get something damning, make a copy of it and keep that in your gun safe, give a copy to your lawyer, and a third copy in another safe place. Also, have you talked to the local sherrif about the situation? While the police may not seem very responsive to your reports, the sherrif may be able to take a more proactive stance.
If you really want to know how the police feel about your situation, talk to a detective. Especially if you can get an introduction through a family member or friend. Another way you can get a better idea of how the local PD feels about your reports is to get a scanner and listen to the dispatches. Once you learn the lingo, you can listen to how the officers respond and some of what they say when dispatched to domestic violence calls. Just because you feel that they are "not responsive" to your situation may not actually be the case, it is just that they don't have an offense they can effect an arrest with at that time. My guess would be that they are just as frustrated as you are because they have a pretty good idea that the ex is just as big a scumbag as you know he is, but he has not crossed the line enough for them to arrest him.
Just out of curiosity, did someone in law enforcement actually tell you that there wasn't anything they could do until he killed you? If so, that would have been a great time to have had a recorder ... that was inexcusible!
Also, have you contacted a domestic abuse organization in your area? They may not be able to help you immediately, but they may be able to help you find more secure housing, and they will most definitely be able to put you in contact with law enforcement who are definitely going to be much more sympathetic to your situation. They will also be able to put you in contact with a lawyer who specializes in DV and can navigate the halls of justice more effectively on your behalf. This will also add to the paper trail you are building against the ex.
I wish you all the best and will keep you in my prayers.