Since you have concluded that the sound works from the headphone jack without the speaker plugged these are the things you could do to rule out some stuff. Might be more options but here is what I can help with:
-Test the speaker by itself to exclude that there is something wrong with it. You can look up simple circuits for speakers online to test it or use an arduino or a signal generator.
Check the signal from the board with the speaker wires connected to an osiclloscope i.e remove the speaker and connect the wires to an oscilloscope. Then you play a sine wave from the raspberry pi and it should show up on the scope. You can do a visual inspection of the signal and then do a FFT on the scope to see what frequencies you are getting. So you can check for noise or check if something does not add up.
-Use some isopropyl alcohol to remove all that ugly grime from the pcb, when soldering the wires twist them to reduce the emf that might happen and reduce noise because the magnetic fields cancel out.
-You can check under a microscope on your pcb connection to see if its legit, there might be some issues with your soldering cause it aint pretty.
-Now if you fucked up your soldering you can actually wire the speaker directly from the headphone jack as in the image below since the pcb probably just extends the connections and routes it to a better physical location. Note that in the picture the soundcard and potentiometer is probably already built into the board.
Edit: formatting and clarification since I was in a rush when I wrote it