Yes it is illegal, But there is no way for them to know.
I've sorted out the ring mains in my house, swapped out a fuse box and rigged up all the lighting in my room behind cavity walls, and also tampered with the telephone lines eliminating the ring line to lower static interference.
It was all safe and I looked up before I did this however, you can mess with your telephone line, I think that is actually legal, you cannot get shocked by the voltage going through the line when not ringing, you just need to find out how to correctly install it.
You could post a picture of the whole box so we can have a better understanding of the wiring. BT Master sockets aren't the most difficult of things to figure out, you'll easily be able to do it by googling. Just make sure you wire it back up properly otherwise your line will not work!
With a phone line, nothing will go bang, pop, nor will you see any sparks. All that'll happen is you'll have a non-working telephone line.