Re: .40 ammo sugestions
+1 on Spazz's comment.
There is a 1% chance it's a gun, 1% chance it's the ammo, but...
Either of those ammos should be shooting one hole groups at 7 yards. I mean all of this to be helpful, rather than a critique, as we've all been there.
Basically, you're shooting a notoriously snappy, flinch-inducing caliber. As Snappy said, it's not unusual to shoot snappy guns very well at first, and watch your group sizes open up as your brain gets more and more punished by the explosions going off in your face.
The fix here is dry firing, dry firing, and more dry firing. Build the neurological pathways in your brain that perfect front sight focus and perfect trigger squeeze do not lead to big explosion in your face. Eventually, those habits (of maintaining both eyes open, perfect front sight focus, and perfect trigger squeeze) get so ingrained that even a big noise right in front of your face won't disturb them much.
Also, double up on earplugs with ear muffs over them--if you aren't already. This may help.
I'd say that most folks agree there are four components to shooting well:
1. Front sight focus
2. Trigger control
3. Sight alignment (easily and quickly grasped by most people)
4. stance (matters, but as long as it's reasonable, most people are fine.)
Most shooters learn 3. and 4. fairly quickly. What really differentiates a master pistol shooter from a novice is that they do 1. and 2. perfectly, every single time, at whatever speed they're shooting. It ain't much more complex than that. If your bullets aren't going in the same hole, and at that distance they should be, it's probably 75% trigger control and 25% lasering your eyes onto that front sight before, during, and after the gun goes off.
PS--having an expert pistol shooter there to help you is about 1000% more useful than internet diagnosis