Can apex:param pass null for Integers?
It looks like the problem is that when the parameter comes over as an empty string, salesforce converts the value to 0 instead of NULL. You could consider setting the value of index in your method based on the param value string:
public void doSomething() {
String ParamValue = Apexpages.currentPage().getParameters().get('indexValue');
index = ParamValue == '' ? NULL : Integer.valueOf(ParamValue);
System.debug(index);
}