I fully agree with both of these. The server keeps track of who last attacked a player and when (and the same can be done for each vehicle), so no reason the kill can't be credited to the player that last attacked the vehicle.
The problem comes with reliability. If I shoot someone's car with a single bullet and do 1hp of damage, then they drive into a gas station (which I can't really detect), I'd end up crediting the guy that took 1hp from the vehicle with the kill...
I have no idea what data you have access to, so these ideas were the first that came to my mindSetting a Damage Threshold: One way to handle this situation could involve setting a certain threshold of damage before the kill attribution kicks in. This means only players who've dealt a substantial amount of damage to a vehicle would be considered for the kill credit when the explosion occurs. Minor dings wouldn't be factored into the equation.
Checking Proximity: Another approach could involve checking the proximity of players to the explosion site. If a player who caused damage to the vehicle is far away when it goes boom, they wouldn't be in the running for the kill attribution. This keeps things fair and avoids any unlikely scenarios.
Time Window for Damage: To avoid attributing kills to players who might have caused minuscule damage ages ago, you could introduce a time window. This means only players who've inflicted damage within a specific time frame leading up to the explosion would be considered for the kill. This helps ensure that the right players get the credit they deserve.
I think the 3 combined would be best.
Also, if a player enters a gas station with a car, it's their fault. Anyway, this case is much less common than a player committing suicide to avoid giving kills, in my opinion.