Based on their respective number of degrees of freedom, what's the most efficient fuel; hydrogen or gasoline?
It sounds like most of your confusion is coming from the fact that you are assuming that the vibrational degrees of freedom are completely frozen out at moderate temp. This is a common misconception. To see that this assumption is not true, we can look at the simple example of carbon dioxide. It is a linear molecule, so it has three degrees of translational freedom and two of rotation. If vibrational modes do not contribute at all, we expect that $\overline{C}_v=\frac52 R$ and $\overline{C}_p=\frac72 R$, so $\gamma=\dfrac{C_p}{C_v}=1.4$. If we include the 4 vibrational degrees of freedom, each of which contributes 1R to $\overline{C}_v$, we would have $\dfrac{C_p}{C_v}=1.15$. The experimental value at $20$ $^\circ C$ is about 1.3, indicating that the vibrational modes are already contributing to the heat capacity at this temperature. A plot of the heat capacity as a function of temp shows a gradual increase across a very wide range of temperature. 

More rigorously, the contribution of a vibrational degree of freedom to the molar heat capacity is  

$$R\cdot\left(\frac{\Theta}{T}\right)^2\cdot\frac{e^{\Theta/T}}{(e^{\Theta/T}-1)^2},$$

where the "vibrational temperature" $\Theta=\dfrac{hcv}{k_B}$. For the lowest energy vibrational normal modes of $\ce{CO2}$, $v=667 cm^{-1}$, so $\Theta = 961 K$. Although this is quite a bit higher than typical temperatures of interest, the above expression tells us that these vibrations contribute $\sim 0.45 R$ to $\overline{C}_v$ at 300 K. Since there are two modes at this frequency in $\ce{CO2}$, we expect that $\overline{C}_v$ and $\overline{C}_p$ are both increased by 0.9R at 300 K relative to the values excluding vibrations. This correction gives a value of $\dfrac{C_p}{C_v}$ very close to observed experimental value. 

Going back to your case of octane, there are a number of normal modes with frequencies around 720 cm$^{-1}$, certainly low enough to contribute at 300 K. We have 18 + 8 = 26 total atoms, so we expect a maximum of 3*26=78 degrees of freedom. Since octane is not linear (in the strict sense of all atoms in a single line), there are 6 non-vibrational DOF. Thus, we expect that the number of degrees of freedom calculated using your method based on the experimental specific heat should be somewhere between these numbers. 

Your calculation, however, needs to be corrected to account for the fact that vibrational degrees of freedom contribute 1R rather than R/2, so the equation becomes

$$\overline{C}_v = 3 R + (f-6)R.$$

From that, I get $f=33.8$, well within our expected range. You can repeat the rigorous calculation using the exact frequency of each normal mode of octane and see how close the result is to the experimental value.

UPDATE: To address the efficiency calculation, note that including the vibrational modes changes your equation for $\gamma$. Now we have that $\overline{C}_v=R(3+f-6)$ for (nonlinear) octane and $\overline{C}_v=R(\frac52)$ for hydrogen (ignoring its one vibrational mode). If we use the apparent degrees of freedom of octane of 33.8, $\gamma_{octane}=1.0325$ and $\gamma_{H2}=1.4$. [Note also that there is really no reason to calculate those apparent degrees of freedom except for curiosity, since we can just add R to the given $\overline{C}_v$ to get $\overline{C}_p$ and divide to get $\gamma_{octane}$.] From that I get an efficiency of 6.5% for the octane and 56% for the hydrogen.