I sympathise here. I have the same problem. I do a spin class at 8.15pm and if I have dinner at 5pm along with my injection of Humalog it's difficult to decide how much to inject as you need insulin and lots of it for the first hour but then you don't want insulin around after this. The trouble is with Humalog or Novorapid it is and for up to 5 hours necessitating the need to consume copious amounts of Lucozade especially if I push myself hard in spin! I have tried reducing my Humalog injection dose to about 2/3 of the dose so from 12iu to 8iu. This depends on your levels at the time of injection and of course you could always delay eating for 20 minutes to give the reduced dose some time to start working. Factor this in around work, traffic and other aspects of life and it gets difficult. I can honestly say that it's in the minority where I get everything spot on and manage to exercise hard and not either end up low or high!
That said you are using a pump so you should have more flexibility. The advice about using a TBR 2 hours before the class is really good too but do more tests to keep everything in check. There is nothing worse than trying to warm the body up for 10 minutes at the start of a spin class with a high blood sugar. It's sucks big time!!!
There is a new solution hopefully on its way soon, the inhalable insulin Afrezza. That will allow you to take your normal dose of insulin before your meal and most of it will be out of your system within an hour so there will be no tail effect forcing you to drink Lucozade to save your life. In fact when I was lucky enough to trial Afrezza, on my first day, September 1st 2015, I did a spin class(I know a little crazy!!!). I took a meal dose at 6pm, ate my dinner and went for a spin at 8.15pm and required no more than a mouthful of Lucozade to keep my levels in range and I then drank water for the rest of the class. It was amazing. Anyhow until Afrezza arrives and is more readily available in the UK, we will have to make do. My advice is to keep going with what you are doing and use the TBR. You will get a system that works for you and keeps you as close to normal range as possible.