In standard BCA ruling (Billiards Congress of America), this would be a loss. If
If at any time you pocket the 8-ball, before the rest of your 7 object balls (solids/stripes), or during the shot on your last object ball, the game would end. The
The cue-ball must come to a stop after your last object ball has dropped before you can take a legal shot at the 8-ball.
In your scenario, your score would be 7 (one for each object ball dropped), your opponents score would be 10. Winner always receives 10pts, even if they have object balls left on table (i.e. you accidentally drop the 8-ball early)