I think misdiagnosis is common reading the posts on here and from my own experience. I ended up with pancreatis caused by gallstones but it was a while before anyone figured out what the problem was.
I was getting severe pain, usually during the night, but was so busy at work that I wasn't able/allowed time off to see a GP. At one point a colleague found me on my hands and knees in the Ladies in so much pain. So that evening on the way home, I stopped at a private GP walk-in service and paid £60 to see someone. They said I had a chest infection and gave me an expensive private prescription. The next day at work, I was still struggling and it was a Friday so I was worried I wouldn't be able to see a doctor if it got worse over the weekend so I stopped at the private GP walk-in again on my way home (another £60, another expensive prescription!). This time they said it was the start of a stomach ulcer.
That Fri night I woke up at 1am in absolute agony. I can't even begin to explain the pain but I remember wishing I had a shotgun so I could shoot myself to make it stop. It took me over an hour to be able to dial 999 for an ambulance (even though the phone was right next to my bed). I was taken into A&E. They couldn't work out what was wrong with me and I couldn't even keep water down let alone the pills they tried to give me. Eventually at 5am, even though I could barely stand and they didn't know what was wrong with me, a nurse told me I was being discharged. I had no-one to collect me, no money to get home, nothing except for my door keys, my dressing gown and my knickers. The nurse just said too bad, you'll have to wait in reception until there's someone awake you can call (family were 6 hours away and I'd recently split with my BF who was 1.5 hours away). Luckily a passing doctor overheard the conversation and demanded that I was taken back to a cubicle and examined properly. A consultant was called and they diagnosed it as acute pancreatitis caused by gallstones (I had a scan at 7am). I ended up in hospital in HDU on morphine for 10 days. The consultant said that if I'd gone home (when they were trying to send me), I would have been dead within less than 24 hours. . That doctor saved my life and I am forever grateful. My pancreas was too inflamed for my gall bladder to be removed so I had to wait 2 months for the operation. It was a relief when it finally happened (although it ended up being open surgery and taking 5 hours due to complications from how ill I'd been).
What shocks me the most is that when I hear people talking about their symptoms, there are certain words that are triggers to think "gallstones" or "pancreatitis". So I don't understand how an A&E dept couldn't have even managed a guess initially at what might be wrong with me. I had classic symptoms, was the classic age (and overweight at the time). I guess it's a sign of how underfunded our NHS is and the pressure that is put on NHS staff.
Apologies for the long story. What I'm saying OP is don't be fobbed off. Please keep pushing until you get the help you need. It makes me nervous when you say you only get the pain at night. I was the same until the last couple of days when I got the pain during the day a little too. I wouldn't want you to go through what I went through. It was terrifying to be alone and in so much pain.
In terms of what you can do to minimise the pain before you have the operation, keep your diary fat free. Not low fat, it has to be fat free i.e. 0.1% fat or less. There are a lot of good sources of fat free cooking advice on the net. It's restrictive but it will help prevent attacks.