In theory, you can replace a i3 with an i5 or i7, if ..
1. The memory speed is compatible, chance are it is.
2. The bios supports other cpu's, probably it does.
3. The cooling solution can handle the heat output, maybe if you choose a cpu that has the same or less TDP at full power, including any turbo overclock or all cores on full.
Now, would I do it, hmmm, I'm an IT Engineer and know about this stuff and have done upgrades, an average user, could run into issues or fubar their hardware.