First thing you should try to do is find a gun range that will let you rent both of them or if you can't at least a shop so you can hold them & see which feels better. In regards to those 2 guns, I've never fired the P-07 but I do like the S&W. Another gun you should consider is the Glocks (26, 27, 19, 23), they're lower maintenance & popular for a reason. When it comes to the caliber I'm sure you'll get plenty of varrying views but personally I prefer the 9mm, it has plenty of stopping power, usually hold more rounds, has cheaper ammo to practice with, & with the lower recoil allow me to put more shots on target faster.
The .40 is a great caliber too though & I'm sure you'll get plenty of good advise on here but nothing will benefit you more than handling & shooting them.