Could having gas have anything to do with heart palpitations?

It's possible. In general the two conditions are separate. However it is possible that gassy pain is actually heart pain because the heart is not getting enough oxygen. If the gas happens with exertion or emotional stress, then this would be more likely. The gassy pain and heart palpitations could then both be related to one underlying heart condition. But more info is needed to really know.